mirror of https://github.com/django/django.git
Fixed #34601 -- Added field name to check message for ModelAdmin.readonly_fields.
Co-authored-by: Rick van Hattem <wolph@wol.ph>
This commit is contained in:
parent
f9936deed1
commit
89c27d8672
|
@ -771,10 +771,11 @@ class BaseModelAdminChecks:
|
|||
except FieldDoesNotExist:
|
||||
return [
|
||||
checks.Error(
|
||||
"The value of '%s' is not a callable, an attribute of "
|
||||
"'%s', or an attribute of '%s'."
|
||||
"The value of '%s' refers to '%s', which is not a callable, "
|
||||
"an attribute of '%s', or an attribute of '%s'."
|
||||
% (
|
||||
label,
|
||||
field_name,
|
||||
obj.__class__.__name__,
|
||||
obj.model._meta.label,
|
||||
),
|
||||
|
|
|
@ -675,8 +675,9 @@ with the admin site:
|
|||
* **admin.E033**: The value of ``ordering`` refers to ``<field name>``, which
|
||||
is not a field of ``<model>``.
|
||||
* **admin.E034**: The value of ``readonly_fields`` must be a list or tuple.
|
||||
* **admin.E035**: The value of ``readonly_fields[n]`` is not a callable, an
|
||||
attribute of ``<ModelAdmin class>``, or an attribute of ``<model>``.
|
||||
* **admin.E035**: The value of ``readonly_fields[n]`` refers to
|
||||
``<field_name>``, which is not a callable, an attribute of
|
||||
``<ModelAdmin class>``, or an attribute of ``<model>``.
|
||||
* **admin.E036**: The value of ``autocomplete_fields`` must be a list or tuple.
|
||||
* **admin.E037**: The value of ``autocomplete_fields[n]`` refers to
|
||||
``<field name>``, which is not a field of ``<model>``.
|
||||
|
|
|
@ -798,8 +798,9 @@ class SystemChecksTestCase(SimpleTestCase):
|
|||
errors = SongAdmin(Song, AdminSite()).check()
|
||||
expected = [
|
||||
checks.Error(
|
||||
"The value of 'readonly_fields[1]' is not a callable, an attribute "
|
||||
"of 'SongAdmin', or an attribute of 'admin_checks.Song'.",
|
||||
"The value of 'readonly_fields[1]' refers to 'nonexistent', which is "
|
||||
"not a callable, an attribute of 'SongAdmin', or an attribute of "
|
||||
"'admin_checks.Song'.",
|
||||
obj=SongAdmin,
|
||||
id="admin.E035",
|
||||
)
|
||||
|
@ -814,8 +815,9 @@ class SystemChecksTestCase(SimpleTestCase):
|
|||
errors = CityInline(State, AdminSite()).check()
|
||||
expected = [
|
||||
checks.Error(
|
||||
"The value of 'readonly_fields[0]' is not a callable, an attribute "
|
||||
"of 'CityInline', or an attribute of 'admin_checks.City'.",
|
||||
"The value of 'readonly_fields[0]' refers to 'i_dont_exist', which is "
|
||||
"not a callable, an attribute of 'CityInline', or an attribute of "
|
||||
"'admin_checks.City'.",
|
||||
obj=CityInline,
|
||||
id="admin.E035",
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue