Opened 11 years ago
Closed 11 years ago
#22913 closed Bug (needsinfo)
callable readonly_fields on inline admins have stopped working in trunk
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Attempting to list a callable (either from the model or the inline admin object) in readonly_fields does nothing (no error, but it doesn't appear either). Additionally listing it in 'fields' leads to the following exception:
File "/home/.../django/django/contrib/admin/options.py", line 1391, in changeform_view
formsets, inline_instances = self._create_formsets(request, obj)
File "/home/.../django/django/contrib/admin/options.py", line 1685, in _create_formsets
for FormSet, inline in self.get_formsets_with_inlines(*get_formsets_args):
File "/home/.../django/django/contrib/admin/options.py", line 736, in get_formsets_with_inlines
yield inline.get_formset(request, obj), inline
File "/home/.../django/django/contrib/admin/options.py", line 1832, in get_formset
return inlineformset_factory(self.parent_model, self.model, **defaults)
File "/home/.../django/django/forms/models.py", line 1013, in inlineformset_factory
FormSet = modelformset_factory(model, **kwargs)
File "/home/.../django/django/forms/models.py", line 835, in modelformset_factory
labels=labels, help_texts=help_texts, error_messages=error_messages)
File "/home/.../django/django/forms/models.py", line 545, in modelform_factory
return type(form)(class_name, (form,), form_class_attrs)
File "/home/.../django/django/forms/models.py", line 293, in __new__
raise FieldError(message)
django.core.exceptions.FieldError: Unknown field(s) (name_of_field) specified for NameOfModel
Note:
See TracTickets
for help on using tickets.
I couldn't reproduce this using the information you provided. Could you include minimal sample code to reproduce and bisect to the commit where the behavior changed?