Opened 13 years ago

Closed 13 years ago

#16382 closed Bug (fixed)

WizardView: Incorrect step numbering

Reported by: anonymous Owned by: nobody
Component: contrib.formtools Version: dev
Severity: Normal Keywords:
Cc: vvangelovski@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am using the example template from the following page of the documentation:
https://docs.djangoproject.com/en/dev//ref/contrib/formtools/form-wizard/#creating-templates-for-the-forms

With Django version SVN-16488, this template renders the first step as Step 0 of 3 rather than Step 1 of 3. Subsequent steps are also zero-based.

Also, what is the difference between step0, index and current? These all appear to produce the same result.

Attachments (1)

form-wizard.diff (564 bytes ) - added by Bernhard Essl 13 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Bernhard Essl, 13 years ago

By default the array index is used as step title. You can overwrite the name of each step.

# doc example in url.py
(r'^$', ContactWizard.as_view([("1", ContactForm1), ("2", ContactForm2)])),

comment:2 by Jannis Leidel, 13 years ago

Triage Stage: UnreviewedAccepted

This seems like a doc bug, should be using something like:

<p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p>

by Bernhard Essl, 13 years ago

Attachment: form-wizard.diff added

comment:3 by Bernhard Essl, 13 years ago

Has patch: set

added a patch for the doc.

comment:4 by steph, 13 years ago

Resolution: invalid
Status: newclosed

Please see https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#creating-templates-for-the-forms

  • current = the zero based step number for WizardView or the step name for NamedUrlWizardView
  • index = always a zero based step number
  • step1 = always a one based step number
  • step0 = a alias for index to have a more intuitive way to get the step number

comment:5 by steph, 13 years ago

Resolution: invalid
Status: closedreopened

comment:6 by steph, 13 years ago

Sorry for closing, I missed the patch which is great! :-)

comment:7 by Vasil Vangelovski, 13 years ago

Cc: vvangelovski@… added

comment:8 by Aymeric Augustin, 13 years ago

Triage Stage: AcceptedReady for checkin

comment:9 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: reopenedclosed

In [16508]:

Fixed #16382 -- Corrected form wizard docs to use one based step number in example template. Thanks, BernhardEssl.

Note: See TracTickets for help on using tickets.
Back to Top