Thursday, May 2, 2013

SessionWizardView fails with plain forms?

I have two forms defined in my project:

class BatchForm(ModelForm):
    class Meta:
        model = Batch


class SelectItemForm(forms.Form):
    item = forms.ModelMultipleChoiceField(queryset=ItemClass.objects.all())


One is a ModelForm, the other is a plain form.

I hooked it into my urls like so:

    url(r'^batch/new/$', NewBatchWizard.as_view([BatchForm, SelectItemForm]), name='batch_new'),

I go through both steps of the form wizard, and the final submit sends me back to the 'BatchForm' page.

The done method is never called in my NewBatchWizard view:

class NewBatchWizard(SessionWizardView):
    def done(self, form_list, **kwargs):
        return render_to_response('test.html', {
            'form_data': [form.cleaned_data for form in form_list],
        })


If I edit my urls.py and get rid of any plain forms (just stick to using ModelForms), my done function is called and everything works perfectly.

It doesn't seem to matter how many steps or ModelForms are in the wizard--the moment I add a plain form, the wizard will always take you back to the first page when done and NOT execute the done function.

I tried creating a new project with a very simple Book/Author setup and I am running into the same issue.

>>> django.VERSION
(1, 5, 1, 'final', 0)
>>> 

I've tried destroying my virtualenv and re-creating it, clearing out all my pyc files, and even tried from a freshly installed Ubuntu server.

Is anyone else seeing this?  Any pointers?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate