8000 [1.5.x] Fixed #22644 -- Clarified documentation for NamedUrlWizardView · alex-python/django@d5ca482 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5ca482

Browse files
committed
[1.5.x] Fixed #22644 -- Clarified documentation for NamedUrlWizardView
Backport of 727d048 from master.
1 parent 044a4fd commit d5ca482

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

docs/ref/contrib/formtools/form-wizard.txt

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -671,24 +671,22 @@ Usage of ``NamedUrlWizardView``
671671
.. class:: NamedUrlSessionWizardView
672672
.. class:: NamedUrlCookieWizardView
673673

674-
There is a :class:`WizardView` subclass which adds named-urls support to the
675-
wizard. By doing this, you can have single urls for every step. You can also
676-
use the :class:`NamedUrlSessionWizardView` or :class:`NamedUrlCookieWizardView`
677-
classes which preselect the backend used for storing information (server-side
678-
sessions and browser cookies respectively).
674+
``NamedUrlWizardView`` is a :class:`WizardView` subclass which adds named-urls
675+
support to the wizard. This allows you to have separate URLs for every step.
676+
You can also use the :class:`NamedUrlSessionWizardView` or :class:`NamedUrlCookieWizardView`
677+
classes which preselect the backend used for storing information (Django sessions and
678+
browser cookies respectively).
679679

680-
To use the named urls, you have to change the ``urls.py``.
680+
To use the named URLs, you should not only use the :class:`NamedUrlWizardView` instead of
681+
:class:`WizardView`, but you will also have to change your ``urls.py``.
681682

682-
Below you will see an example of a contact wizard with two steps, step 1 with
683-
"contactdata" as its name and step 2 with "leavemessage" as its name.
683+
The :meth:`~WizardView.as_view` method takes two additional arguments:
684684

685-
Additionally you have to pass two more arguments to the
686-
:meth:`~WizardView.as_view` method:
685+
* a required ``url_name`` -- the name of the url (as provided in the ``urls.py``)
686+
* an optional ``done_step_name`` -- the name of the done step, to be used in the URL
687687

688-
* ``url_name`` -- the name of the url (as provided in the urls.py)
689-
* ``done_step_name`` -- the name in the url for the done step
690-
691-
Example code for the changed ``urls.py`` file::
688+
This is an example of a ``urls.py`` for a contact wizard with two steps, step 1 named
689+
``contactdata`` and step 2 named ``leavemessage``::
692690

693691
from django.conf.urls import url, patterns
694692

@@ -713,9 +711,9 @@ Advanced ``NamedUrlWizardView`` methods
713711

714712
.. method:: NamedUrlWizardView.get_step_url(step)
715713

716-
This method returns the URL for a specific step.
714+
This method returns the URL for a specific step.
717715

718-
Default implementation::
716+
Default implementation::
719717

720-
def get_step_url(self, step):
721-
return reverse(self.url_name, kwargs={'step': step})
718+
def get_step_url(self, step):
719+
return reverse(self.url_name, kwargs={'step': step})

0 commit comments

Comments
 (0)
0