Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12654 closed (fixed)

Admin readonly_fields not working with ForeignKey fields

Reported by: Karataev Pavel Owned by: Karataev Pavel
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If you add any ForeignKey field to readonly_fields, it will displayed in change_view as number (primary key).

Attachments (2)

fix.diff (450 bytes) - added by Karataev Pavel 7 years ago.
test.diff (2.8 KB) - added by Karataev Pavel 7 years ago.
Better tests

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Karataev Pavel

Attachment: fix.diff added

comment:1 Changed 7 years ago by Alex Gaynor

Has patch: set
Triage Stage: UnreviewedAccepted

The fix looks reasonable, can you work up a test case for this?

comment:2 Changed 7 years ago by Karataev Pavel

Owner: changed from nobody to Karataev Pavel
Status: newassigned

yes, i will write it in regressiontests/admin_util/tests.py

Changed 7 years ago by Karataev Pavel

Attachment: test.diff added

Better tests

comment:3 Changed 7 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

(In [12366]) Fixed #12654 - Correctly display ForeignKey fields in read-only scenarios. Thanks, minmax.

comment:4 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top