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

Skip to content

Commit 727d048

Browse files
committed
Fixed #22644 -- Clarified documentation for NamedUrlWizardView
1 parent a0d5970 commit 727d048

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
@@ -714,24 +714,22 @@ Usage of ``NamedUrlWizardView``
714714
.. class:: NamedUrlSessionWizardView
715715
.. class:: NamedUrlCookieWizardView
716716

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

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

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

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

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

736734
from django.conf.urls import url
737735

@@ -756,9 +754,9 @@ Advanced ``NamedUrlWizardView`` methods
756754

757755
.. method:: NamedUrlWizardView.get_step_url(step)
758756

759-
This method returns the URL for a specific step.
757+
This method returns the URL for a specific step.
760758

761-
Default implementation::
759+
Default implementation::
762760

763-
def get_step_url(self, step):
764-
return reverse(self.url_name, kwargs={'step': step})
761+
def get_step_url(self, step):
762+
return reverse(self.url_name, kwargs={'step': step})

0 commit comments

Comments
 (0)
0