self.request
is the way to get the request objectself.args
andself.kwargs
are the URL parameters fromurls.py
(they are also passed to almost every method, but they're not always, and some methods take anargs
andkwargs
that aren't the ones from the URL, so... just useself.
everywhere!)dispatch
is called beforeget
orpost
so is a useful place to setup stuff you need everywhere- the view object itself is available in the template as
view
, so templates can access view methods and properties - Detail and List views don't just get the template variables
object
andobject_list
, they also get<model-name>
and<model-name>_list
- Permission decorators etc are better handled by django-braces
Last active
April 10, 2017 13:10
-
-
Save benbacardi/852e4bd9070c7a014e459a7a395f8c4f to your computer and use it in GitHub Desktop.
Django CBV Notes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment