Opened 12 years ago

Closed 10 years ago

#19981 closed New feature (fixed)

Pass request to WizardView.get_prefix

Reported by: joshdrake Owned by: nobody
Component: contrib.formtools Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

This ticket is related to https://code.djangoproject.com/ticket/17162 in that it was addressed by the initial patch but didn't make it in the patch that was eventually applied. In a subsequent comment on the ticket, Jannis stated that the request parameter should be removed from the method signature as it would be available on the view instance itself. However, this is incorrect as the WizardView.get_prefix method is called from within WizardView.dispatch before the request attribute is set on the view instance. In this case, WizardView.dispatch delegates this to the dispatch of the ancestor class (View) using super.

The pull request for this ticket simply adds the request parameter to this method. As noted in the original ticket, being able to leverage the request data for generating a unique prefix allows for a lot more flexibility. One example of this could be simply using a random token and a hidden input on each form step. There's still a TODO on the get_prefix method even indicating that some kind of unique identifier should be added, so if anyone has any ideas on what a reasonable approach for that would look like I can tackle it.

Change History (5)

comment:2 by Jacob, 12 years ago

Triage Stage: UnreviewedAccepted

comment:3 by steph, 12 years ago

I think adding request to the get_prefix method is a good idea. Could you also update the docs in your pull request? A test to verify that a valid request is passed to the method would be nice too.

comment:4 by Jannis Leidel, 12 years ago

Needs documentation: set
Needs tests: set
Patch needs improvement: set

comment:5 by Greg Chapple, 10 years ago

Resolution: fixed
Status: newclosed

formtools has been extracted into its own repository (​​https://github.com/django/django-formtools/). Because of this, the issue tracking for this package has been moved to GitHub issues. I'm going to close this ticket, but I've created a GitHub issue to replace it where the conversation can continue: ​​https://github.com/django/django-formtools/issues/18. Thanks!

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