Add min_num and validate_min on formsets
|Reported by:||Gabriel Farrell||Owned by:||Rogério Yokomizo|
|Cc:||mathijs@…, tgecho, kitsunde@…, timograham@…, me@…, tchristiansen||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
Formsets have a max_num for limiting the number of forms, but no way to ensure a minimum.
Use case: I want an address formset that displays all addresses that have been created and no extras, unless there are no addresses, then one empty form should be displayed. I would set extra=0 and min_num=1.
Patch included is just a beginning. I may have missed a function or two and I haven't touched docs or tests.
Change History (36)
comment:21 Changed 4 years ago by
|Patch needs improvement:||set|
|Summary:||min_num on formsets → Add min_num on formsets|
comment:23 Changed 3 years ago by
|Summary:||Add min_num on formsets → Add min_num and validate_min on formsets|