Opened 14 years ago

Closed 14 years ago

#12085 closed (duplicate)

Links to FKs in Admin (proposal)

Reported by: Vlada Macek Owned by: nobody
Component: contrib.admin Version: dev
Severity: Keywords:
Cc: t.django@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I frequently miss the admin ability to automatically link to change_forms of objects referenced by FKs:

Currently when a ForeignKey field is in list_display, the target's __unicode__ is called and displayed in the cell. Why not to as well make it a link to the target's change_form provided it has ModelAdmin registered and the user has the permissions?

Can be controlled by some new attribute of ModelAdmin, say foreign_key_links as the tuple of such fields.

Yes, I can currently simulate that by creating a model method for each foreign key returning <a> with allow_tags=True and replace the FK field in list_display, but these fields are second grade citizens:

  • cannot be ordered by
  • cannot be filtered upon
  • defining them is tedious
  • the quickiest dirty way is to hardcode the target URL to <a>

Sorry if it's duplicate or the feature is already in. Was unable to find it.

Change History (3)

comment:1 by Russell Keith-Magee, 14 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #7028

comment:2 by dschruth, 14 years ago

Resolution: duplicate
Status: closedreopened

I don't think this should have been closed. Seems like these two tickets are slightly different. What about adding a simple link (no pop-ups) just above the 'select' tag, which would link to the change_form? I'm envisioning similar functionality to what happens with the ImageField and the FileField in the admin interface.

comment:3 by James Bennett, 14 years ago

Resolution: duplicate
Status: reopenedclosed

Don't reopen tickets closed by a committer. If you disagree with a ticket being closed, consult the documentation for the appropriate way to raise your concerns.

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