formwizard/views.py
class NamedUrlWizardView(WizardView):
def get(self, *args, **kwargs):
"""
This renders the form or, if needed, does the http redirects.
"""
step_url = kwargs.get('step', None)
if step_url is None:
if 'reset' in self.request.GET:
self.storage.reset()
self.storage.current_step = self.steps.first
if self.request.GET:
query_string = "?%s" % self.request.GET.urlencode()
else:
query_string = ""
next_step_url = reverse(self.url_name, kwargs={
'step': self.steps.current,
}) + query_string
return redirect(next_step_url)
and continues...
Notice where it says "next_step_url = ... kwargs = { 'step': ..."
It's not passing in anything else, in particular is not doing
something like url%self.kwargs. So if my wizard is nested in a
parametrized URL, this piece of code won't return valid URLs:
urlpatterns += patterns('accounts.jobs.views.wizard',
url(r'^wizard/(?P<job_id>\d+)/(?P<step>.+)/$', job_wizard,
name='job_step'),
url(r'^wizard/(?P<job_id>\d+)/$', job_wizard, name='job_wizard'),
)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment