[Fixed]-Class based views (can't follow the book narration)

1👍

As far as I can tell the book is wrong about point 2.
When you provide a keyword argument to as_view it’s checked to see if the class has that attribute or else throws a TypeError like the one you get.

One other noteworthy point is that you cannot use any of the http_method_names as keyword arguments in as_view. (ie. get, post, put, delete, etc) as those are restricted entry points for class based views in Django. You can however override them in your own view class.

Point 3 I think is a misinterpretation. The book doesn’t actually say that it throws the error, instead it tells you should throw an Improperly configured in those cases.

Leave a comment