mirror of
https://github.com/django/django.git
synced 2025-09-08 19:50:48 +00:00
Refs #20456 -- Moved initialization of HEAD method based on GET to the View.setup() for generic views.
This will ease unit testing of views since setup will essentially do everything needed to set the view instance up (other than instantiating it). Credit for idea goes to Vincent Prouillet.
This commit is contained in:
parent
31d1822532
commit
c2c27867ef
4 changed files with 12 additions and 7 deletions
|
@ -79,12 +79,9 @@ MRO is an acronym for Method Resolution Order.
|
|||
|
||||
.. method:: setup(request, *args, **kwargs)
|
||||
|
||||
Initializes view instance attributes: ``self.request``, ``self.args``,
|
||||
and ``self.kwargs`` prior to :meth:`dispatch`.
|
||||
Performs key view initialization prior to :meth:`dispatch`.
|
||||
|
||||
Overriding this method allows mixins to setup instance attributes for
|
||||
reuse in child classes. When overriding this method, you must call
|
||||
``super()``.
|
||||
If overriding this method, you must call ``super()``.
|
||||
|
||||
.. method:: dispatch(request, *args, **kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue