mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Added some class attributes to pass initial form lists to the WizardView without the need to add them in the as_view call.
This commit is contained in:
parent
930af661ab
commit
b614c47f8c
3 changed files with 67 additions and 10 deletions
|
@ -245,6 +245,13 @@ wizard's ``as_view()`` method takes a list of your
|
|||
(r'^contact/$', ContactWizard.as_view([ContactForm1, ContactForm2])),
|
||||
)
|
||||
|
||||
.. versionchanged:: 1.6
|
||||
|
||||
You can also pass the form list as a class attribute named ``form_list``.
|
||||
|
||||
class ContactWizard(WizardView):
|
||||
form_list = [ContactForm1, ContactForm2]
|
||||
|
||||
.. _wizard-template-for-each-form:
|
||||
|
||||
Using a different template for each form
|
||||
|
@ -295,6 +302,14 @@ The ``urls.py`` file would contain something like::
|
|||
(r'^checkout/$', OrderWizard.as_view(FORMS, condition_dict={'cc': pay_by_credit_card})),
|
||||
)
|
||||
|
||||
.. versionchanged:: 1.6
|
||||
|
||||
The ``condiction_dict`` can be passed as attribute for the ``as_view()``
|
||||
method or as a class attribute named ``condition_dict``.
|
||||
|
||||
class OrderWizard(WizardView):
|
||||
condition_dict = {'cc': pay_by_credit_card}
|
||||
|
||||
Note that the ``OrderWizard`` object is initialized with a list of pairs.
|
||||
The first element in the pair is a string that corresponds to the name of the
|
||||
step and the second is the form class.
|
||||
|
@ -550,6 +565,11 @@ Providing initial data for the forms
|
|||
The ``initial_dict`` can also take a list of dictionaries for a specific
|
||||
step if the step is a ``FormSet``.
|
||||
|
||||
.. versionchanged:: 1.6
|
||||
|
||||
The ``initial_dict`` can also be added as a class attribute named
|
||||
``initial_dict`` to avoid having the initial data in the ``urls.py``.
|
||||
|
||||
.. _wizard-files:
|
||||
|
||||
Handling files
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue