Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#12654 closed (fixed)

Admin readonly_fields not working with ForeignKey fields

Reported by: minmax Owned by: minmax
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 minmax 5 years ago.
test.diff (2.8 KB) - added by minmax 5 years ago.
Better tests

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by minmax

comment:1 Changed 5 years ago by Alex

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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

comment:2 Changed 5 years ago by minmax

  • Owner changed from nobody to minmax
  • Status changed from new to assigned

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

Changed 5 years ago by minmax

Better tests

comment:3 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:4 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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