Validation error with formwizard and formset

220 views
Skip to first unread message

Rob

unread,
Jul 21, 2012, 5:46:37 AM7/21/12
to django...@googlegroups.com
I have a basic formwizard example from the Django 1.4 documentation:
https://docs.djangoproject.com/en/1.4/ref/contrib/formtools/form-wizard/

When I replace the forms with a modelform and a formset i keep getting validation errors:
(ManagementForm data is missing or has been tampered with)

The documentation says:
WizardView supports ModelForms and ModelFormSets. Additionally to initial_dict, the as_view() method takes an instance_dict argument that should contain instances of ModelForm and ModelFormSet. Similarly to initial_dict, these dictionary key values should be equal to the step number in the form list.

Could anybody provide me with an example? Does the validation error have something to do with the instance_dict?

Let say i have these forms:
class Address(models.Model):
        street = models.CharField(max_length=20)

class AddressForm(ModelForm):
        class Meta:
                model = Address

class OrderForm(forms.Form):
    Order = forms.ModelChoiceField(queryset=Article.objects.all())
   
OrderFormset = modelformset_factory(Order)

Rob

unread,
Jul 21, 2012, 7:33:13 AM7/21/12
to django...@googlegroups.com
The validation error i got was due to a custom view i wrote, and had nothing todo my my template etc etc. I switched back to the default example view provided by the Django site, and everything works.
Reply all
Reply to author
Forward
0 new messages