Hi,

 I would need to enforce the max_num and min_num  attributes of formsets on 
my admin pages at validation time.
>From the documentation and the source, it seems that validate_max and 
validate_min would be the FormSet attributes that need to set to True for 
that to happen.

Yet, while investigating this issue, it seems to me that it is currently 
not possible to forward them to FromSet classes used in the Admin site:
1) From InlineModelAdmin.get_formset() code 
<https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1810-L1819>,
 
it is not useful to set validate_* on the inline itself, as it would not be 
forwarded to the inlineformset_factory() call on return.
2) From formset_factory() code 
<https://docs.djangoproject.com/en/1.8/_modules/django/forms/formsets/#formset_factory>,
 
it is not useful to set validate_* on the FormSet class itself, because it 
would be overwritten by the argument provided to the factory function.

Are you aware of a way to have the Admin instantiate FormSet classes with 
valide_min and validate_max set to true ?
If not, it seems to me it would be easy to allow it by extending the 
defaults dictionary in 1), so I am curious if there is a rationale for not 
allowing it, or if it is a simple oversight ?

Thank you very much for reading,
  Ad

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a13007d8-8591-479b-b82d-41ad8ab05636%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to