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*<https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/>and 
*ModelFormSets*<https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/#model-formsets>.
 
Additionally to 
initial_dict<https://docs.djangoproject.com/en/1.4/ref/contrib/formtools/form-wizard/#django.contrib.formtools.wizard.views.WizardView.initial_dict>,
 
the as_view() method takes an instance_dict argument that should contain 
instances of ModelForm and ModelFormSet. Similarly to 
initial_dict<https://docs.djangoproject.com/en/1.4/ref/contrib/formtools/form-wizard/#django.contrib.formtools.wizard.views.WizardView.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)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/hCBZxvtz1HYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to