Links to FKs in Admin (proposal)
|Reported by:||Vlada Macek||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||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 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
comment:2 Changed 4 years ago by dschruth
- Resolution duplicate deleted
- Status changed from closed to reopened