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

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20160127212404.GA12110%40gonzales.mama.local.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: PGP signature

Reply via email to