Opened 8 years ago

Closed 8 years ago

#15050 closed Bug (fixed)

FormWizard URLConf documentation misleading

Reported by: root+django@… Owned by: nobody
Component: contrib.formtools Version: 1.2
Severity: Normal Keywords: wizard
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The documentation suggests the following way to plug a FormWizard into the URLConf:

from django.conf.urls.defaults import *
from testapp.forms import ContactForm1, ContactForm2, ContactWizard

urlpatterns = patterns('',
    (r'^contact/$', ContactWizard([ContactForm1, ContactForm2])),

Unfortunately, this causes a single instance of the wizard to serve the whole application. Basically, all instance attributes are shared between all visitors (e.g. self.step, so the wizard is effectively unusable).

To make the wizard handle every request in a dedicated instance, a wrapper function could be used, a'la:

def contact_wizard(request, *args, **kwargs):
    wizard = ContactWizard([ContactForm1, ContactForm2])
    return wizard(request, *args, **kwargs)

urlpatterns = patterns('',
    (r'^contact/$', contact_wizard),

Change History (3)

comment:1 Changed 8 years ago by Russell Keith-Magee

Component: Documentationdjango.contrib.formtools
Keywords: wizard added
Triage Stage: UnreviewedAccepted

This isn't just a documentation issue -- it's pointing at a pretty glaring hole in the formwizard as currently implemented.

Essentially, FormWizard needs to be updated to use Django's own class-based view structure (which took a long time to finalize specifically because of the issue you describe here). The good news is that there is at least one effort in the works to do just this -- Stephan Jäkel, has been working on django-formwizard to address this, and a couple of other problems with the FormWizard framework (#7439, #9200, #11112).

comment:2 Changed 8 years ago by anonymous

Severity: Normal
Type: Bug

comment:3 Changed 8 years ago by Jannis Leidel

Easy pickings: unset
Resolution: fixed
Status: newclosed

Superseded by #9200.

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