Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#22372 closed Cleanup/optimization (fixed)

Incorrect docstring in wizard views

Reported by: Simon Litchfield Owned by: Vishal Lal
Component: Forms Version: 1.6
Severity: Normal Keywords:
Cc: Vishal Lal Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In formtools.wizard.views.get_context_data, the docstring states the "wizard instance itself" is available in the template, but this is not correct.

The context includes a variable "wizard", but it is not the instance (as you would expect). This is confusing and dumb. Either the code should be changed (preferred, unless there is some paranoid security concern I'm not considering); or the docstring fixed and docs updated.

Change History (5)

comment:1 Changed 3 years ago by Alex Gaynor

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 3 years ago by Vishal Lal

Cc: Vishal Lal added
Has patch: set
Owner: changed from nobody to Vishal Lal
Status: newassigned

Also it seems the form instance is actually included as part of the wizard key.

        context['wizard'] = {
            'form': form,
            'steps': self.steps,
            'management_form': ManagementForm(prefix=self.prefix, initial={
                'current_step': self.steps.current,
            }),
        }

It would be easier to modify the docstring and docs to reflect this rather than modify the code and potentially break many things.

Issued Pull Request #2505. Verified documentation builds correctly.

comment:3 Changed 2 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In a8e2ec0e82aaebfa53a8074581b22849896537df:

Fixed #22372 -- Improved description of WizardView.get_context_data().

Thanks simon29 for the report.

comment:4 Changed 2 years ago by Tim Graham <timograham@…>

In 28a686a0b75e118a4a24462f3b3d31c8231f010a:

[1.7.x] Fixed #22372 -- Improved description of WizardView.get_context_data().

Thanks simon29 for the report.

Backport of a8e2ec0e82 from master

comment:5 Changed 2 years ago by Tim Graham <timograham@…>

In 1cce00a7620f1882b3b1999e799eb1d3cc65c1ca:

[1.6.x] Fixed #22372 -- Improved description of WizardView.get_context_data().

Thanks simon29 for the report.

Backport of a8e2ec0e82 from master

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