Pass request to WizardView.get_prefix
|Reported by:||joshdrake||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||yes||Patch needs improvement:||yes|
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 Changed 3 years ago by joshdrake
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:4 Changed 3 years ago by jezdez
- Needs documentation set
- Needs tests set
- Patch needs improvement set