In #26142, we want model formsets to be able to disallow new object
creation. Users try to do this by supplying extra=0, but this does not
prevent the web client from adding more forms to the POST data.
https://code.djangoproject.com/ticket/26142
For non-model formsets, this can be achieved by leveraging the existing
attributes validate_min and validate_max on the Formset. I propose the
following simple implementation that adds can_create, defaulting to
True, which when set to False, sets validate_{min,max} to True,
{min,max}_num to the number of initial forms, and extra to 0.
https://github.com/django/django/pull/6053
For model formsets, this does not seem to be sufficient, as the primary
keys need to be validated as well.
Any comments on this approach or ideas for an alternate way?
I am not sure how to proceed with extending the model formsets.
Best,
Mathias Rav