ModelAdmin._create_formsets can generate formsets with a 'None-1' prefix, which is ugly
|Reported by:||kamni||Owned by:|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In cases where a programmer overrides BaseFormSet.get_default_prefix, it is possible to return a 'None' value due to programmer oversight. The solution currently in place is to add 'or not prefix' to prevent errors (https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1565-L1565). However this results in formsets with a prefix like 'None-1', which looks unfinished and is uninformative when looking at the HTML.
A better choice would be to modify line 1563 to read 'prefix = FormSet.get_default_prefix() or "form"', or another default that might indicate to the developer that their code was failing, without generating ugly html.
Change History (5)
comment:1 Changed 3 years ago by
|Component:||Forms → contrib.admin|
|Patch needs improvement:||unset|