Code

Opened 3 years ago

Closed 3 years ago

#16382 closed Bug (fixed)

WizardView: Incorrect step numbering

Reported by: anonymous Owned by: nobody
Component: contrib.formtools Version: master
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 BernhardEssl 3 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 3 years ago by BernhardEssl

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 3 years ago by jezdez

  • Triage Stage changed from Unreviewed to Accepted

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

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

Changed 3 years ago by BernhardEssl

comment:3 Changed 3 years ago by BernhardEssl

  • Has patch set

added a patch for the doc.

comment:4 Changed 3 years ago by steph

  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 3 years ago by steph

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:6 Changed 3 years ago by steph

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

comment:7 Changed 3 years ago by vasiliyeah

  • Cc vvangelovski@… added

comment:8 Changed 3 years ago by aaugustin

  • Triage Stage changed from Accepted to Ready for checkin

comment:9 Changed 3 years ago by jezdez

  • Resolution set to fixed
  • Status changed from reopened to closed

In [16508]:

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.