Code

Opened 4 years ago

Closed 4 years ago

#12085 closed (duplicate)

Links to FKs in Admin (proposal)

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

Description

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.

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #7028

comment:2 Changed 4 years ago by dschruth

  • Resolution duplicate deleted
  • Status changed from closed to reopened

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 Changed 4 years ago by ubernostrum

  • Resolution set to duplicate
  • Status changed from reopened to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.