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:1 by , 12 years ago
comment:2 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 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 , 12 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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!
Pull request: https://github.com/django/django/pull/879/