[Django] #34601: ModelAdmin: Error message for readonly_fields's check does not include the field name

21 views
Skip to first unread message

Django

unread,
May 29, 2023, 8:21:48 AM5/29/23
to django-...@googlegroups.com
#34601: ModelAdmin: Error message for readonly_fields's check does not include the
field name
------------------------------------------------+------------------------
Reporter: Natalia Bidart | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
When subclassing a `ModelAdmin`, the current error message for the
`readonly_fields` would indicate the index of the value at fault but it
will not include the field's name (from the test suite):

`The value of 'readonly_fields[0]' is not a callable, an attribute of
'CityInline', or an attribute of 'admin_checks.City'.`

Other fields like `list_editable`, `raw_id_fields`, `list_display`, etc.
would also include this value:

`The value of 'list_editable[0]' refers to 'original_release', which is
not contained in 'list_display'.`

It would be good if we can unify this and include the field name in the
`readonly_fields` checks, it also eases the understanding of the error
when using the framework.

--
Ticket URL: <https://code.djangoproject.com/ticket/34601>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 29, 2023, 8:22:56 AM5/29/23
to django-...@googlegroups.com
#34601: ModelAdmin: Error message for readonly_fields's check does not include the
field name
-------------------------------------+-------------------------------------
Reporter: Natalia Bidart | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* owner: nobody => Natalia Bidart
* status: new => assigned


Comment:

There is an [https://github.com/django/django/pull/13169 old and stale PR]
for this, which I resuscitated in [
https://github.com/django/django/pull/16899 this PR].

--
Ticket URL: <https://code.djangoproject.com/ticket/34601#comment:1>

Django

unread,
May 29, 2023, 8:35:55 AM5/29/23
to django-...@googlegroups.com
#34601: ModelAdmin: Error message for readonly_fields's check does not include the
field name
-------------------------------------+-------------------------------------
Reporter: Natalia Bidart | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Sanders):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/34601#comment:2>

Django

unread,
May 29, 2023, 12:36:28 PM5/29/23
to django-...@googlegroups.com
#34601: ModelAdmin: Error message for readonly_fields's check does not include the
field name
-------------------------------------+-------------------------------------
Reporter: Natalia Bidart | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: assigned
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34601#comment:3>

Django

unread,
Jun 4, 2023, 11:57:06 PM6/4/23
to django-...@googlegroups.com
#34601: ModelAdmin: Error message for readonly_fields's check does not include the
field name
-------------------------------------+-------------------------------------
Reporter: Natalia Bidart | Owner: Natalia
Type: | Bidart
Cleanup/optimization | Status: closed
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"89c27d867252d7c81be3de7184578db1934a9318" 89c27d86]:
{{{
#!CommitTicketReference repository=""
revision="89c27d867252d7c81be3de7184578db1934a9318"
Fixed #34601 -- Added field name to check message for
ModelAdmin.readonly_fields.

Co-authored-by: Rick van Hattem <wo...@wol.ph>
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34601#comment:4>

Reply all
Reply to author
Forward
0 new messages