#10557 closed Bug (wontfix)
FormWizard should not output raw HTML for previous_fields
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.formtools | Version: | dev |
Severity: | Normal | Keywords: | wizard sprintnov13 |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
When using a FormWizard
to generate forms it populates a context variable called previous_fields
which contains raw HTML hidden fields for the previous step values and security hashes. This does not play well when you are trying to use the FormWizard in other types markup.
My use case is that I'm using extjs for my application front-end and form presentation (though I could be using something else like XForms for example). I have a templatetag that spits out the appropriate extjs form widget when given a bound field
. This fails for the FormWizard
previous_fields
because it is raw HTML.
The patch attached turns previous_fields
into a list of bound field objects that can be iterated over to output the same raw HTML as before or give you more control over the output.
Attachments (3)
Change History (16)
by , 16 years ago
Attachment: | form_wizard_prev_fields.diff added |
---|
comment:1 by , 16 years ago
milestone: | → 1.2 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 15 years ago
See here for a installable module if you don't want to wait until Django 1.2 arrives.
http://wadofstuff.blogspot.com/2009/07/improved-django-formwizard.html
comment:3 by , 15 years ago
Patch needs improvement: | set |
---|
This doesn't appear to be backwards compatible, which it needs to be if it's to go into 1.2.
comment:4 by , 15 years ago
milestone: | 1.2 → 1.3 |
---|
If it's not backwards-compatible it can't land in 1.2; luckily, you get another release cycle to get it into shape :)
comment:5 by , 14 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
It's 1.3 now and apart from not being backwards compatible, looks good to me. This also helps writing tests, because you don't have to parse the raw HTML to get the security_hash for the next step.
comment:6 by , 14 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Triage Stage: | Ready for checkin → Accepted |
It's not ready for checkin if it's not backwards compatible, as Jacob said before. This needs a much better patch - for example, a new method that provides the new required format. With docs and tests, of course.
comment:7 by , 14 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
.. just added a better patch including tests for the old previous_fields and the new previous_fields_list.
comment:8 by , 14 years ago
There are backwards compatibility issues with changing the signature of FormWizard.render_template
. It is a method that subclasses can override, therefore changes to it must be done with keyword arguments, and any time it is called from the FormWizard
class we must check that the method accepts the keyword argument we want to pass (use inspect.getargspec).
Thanks.
comment:9 by , 14 years ago
Keywords: | sprintnov13 added |
---|
comment:10 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:11 by , 14 years ago
Easy pickings: | unset |
---|---|
Patch needs improvement: | set |
trac-10557.2.diff fails to apply cleanly on to trunk
patch for class and docs