Hi,

I have a function in tests.py that tests the editing of a form, and it
worked fine until I added an inline formset to the form. Now it fails with
this error:

ValidationError: [u'ManagementForm data is missing or has been tampered
with']

I added these lines to the test function:

new['image_form-TOTAL_FORMS'] = 1
new['image_form-INITIAL_FORMS'] = 0
new['table_form-TOTAL_FORMS'] = 1
new['table_form-INITIAL_FORMS'] = 0

new is the dictionary that is being passed to the post function:

response = self.client.post('/myflow/experiment/2/edit', new)

image_form and table_form are the 'prefix' I am passing when creating
image_formset and table_formset.

I chose those values for TOTAL_FORMS and INITIAL_FORMS because they are in
the request POST when I do it on the web, using Firefox. I also tried
strings instead of ints (with u'1' , etc).

Is it obvious what is wrong from just this information? If not, what other
information would be useful to debug this?

The simplest test I have done on the command line was this:

>> ImageFormset = inlineformset_factory(Experiment, Image, ImageForm,
extra=1)

>> data = {
'image_form-INITIAL_FORMS': u'0',
'image_form-TOTAL_FORMS': u'1'
}

>> formset = ImageFormset(data,prefix='image_form')

This works, but if I leave out the prefix in the last command then the same
ValidationError is raised.

Thank you for any help,
Paulo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to