How do you use Django's unittesting Client to fill in inline forms?
In my test, I've tried:
response = client.get('/admin/myapp/prospect/add/')
initial = response.context['adminform'].form.initial
initial['name'] = 'Jon Doe'
response = client.post('/admin/myapp/prospect/add/', initial, follow=True)
but this throws a "ManagementForm data is missing" error because my ModelAdmin has some inline forms, and the form.initial
object doesn't appear to include the boilerplate fields for these inlines, like *-INITIAL_FORMS
, *-MAX_NUM_FORMS
, and *-TOTAL_FORMS
.
Is there a way around this, or does Django's unittest framework not support testing inline forms?