ModelAdmin form validation does not check inherited get_readonly_fields()
|Reported by:||soulne4ny||Owned by:||nobody|
|Severity:||Normal||Keywords:||admin readonly fields validation|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
While trying to create a custom _base_ class InlineModelAdmin with a set of predefined "evaluated"-fields I found that a _child_ inline model admin gets an error
ImproperlyConfigured: 'AnInlineModelAdmin.fields' refers to field 'base_field' that is missing from the form.
For more flexibility I didn't use the readonly_fields attribute, but the get_readonly_fields() method.
However, it works when the readonly_fields attribute is set. After looking in the admin validation code, I found that get_readonly_fields() works well with redefined get_form(), even if it just returns super().
It would be nice to have consistent behavoiur %)
Change History (5)
Changed 11 months ago by soulne4ny
comment:1 Changed 10 months ago by DrMeers
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to invalid
- Status changed from new to closed