Say I have the following models:

class Pizza(models.Model):

class Topping(models.Model):
   pizza = models.ForeignKey(Pizza, related_name='toppings')

I have would like to make an inline formset like so:

PizzaFormSet = inlineformset_factory(Pizza, Topping, 
                                     extra=0, min_num=1)

where PizzaToppingsFormSet inherits from BaseInlineFormSet.

If I have:

form_data = {
   'form-INITIAL_FORMS': 0,
   'form-TOTAL_FORMS': 1,
   'form-0-meat': 'Chicken',
   'form-0-cheeze': 'Mozzarella',
formset = DatesFormSet(form_data)

I get an error django.core.exceptions.ValidationError: ['ManagementForm data is missing or has been tampered with']. I understand I can specify my own prefix like formset = DatesFormSet(form_data, prefix='my_prefix') and then it works.

But I would like to know: what is the default prefix for an inline formset? The Django docs say that for a regular formset the default prefix is form, but this is not the case for an inline formset.

0 Answers