[Answer]-Django 1.7 modelform_factory form is always invalid with factory_boy created model

1👍

This has nothing to do with factory_boy. Forms are always invalid if they don’t have any data, which yours doesn’t. The instance parameter is used to populate the form’s initial data for display, and to determine the object ID for updating, but it isn’t used to set that data on POST.

I’m not quite sure what you want to do with the form there, but you’d need to convert it to a POST dictionary and pass it to the form’s data parameter for it to be valid.

Leave a comment