Opened 3 years ago
Closed 3 years ago
#33267 closed New feature (fixed)
Add Hyperlink to related model in admin change form.
Reported by: | Thomas Güttler | Owned by: | Shubh Parmar |
---|---|---|---|
Component: | contrib.admin | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Phil | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I would like to add a hyperlink next to the select field of a ForeignKey
There is a do-it-yourself way Django Admin: Add Hyperlink to related model, but it would be nice to have declarative solution.
There is an image in the Stackoverflow question which explains it.
Would you accept a PR which implements this?
Attachments (1)
Change History (18)
by , 3 years ago
Attachment: | django-admin-hyperlink-to-related-model.png added |
---|
comment:1 by , 3 years ago
Description: | modified (diff) |
---|
comment:2 by , 3 years ago
Description: | modified (diff) |
---|
comment:3 by , 3 years ago
Component: | Uncategorized → contrib.admin |
---|
comment:4 by , 3 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
comment:5 by , 3 years ago
Summary: | Django Admin: Add Hyperlink to related model → Add Hyperlink to related model in admin change form. |
---|
comment:6 by , 3 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
Sorry for the late reply. The raw_id_fields
displays a hyperlink next to the raw-id. That's great. I would like to have exactly the same for non-raw-id-fields.
The magnifying glass button does something else. It opens a popup. That's not what I was looking for. I was looking for a simple hyperlink to the admin interface of the corresponding ForeignKey.
comment:7 by , 3 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Seems similar to b79088306513d5ed76d31ac40ab3c15f858946ea #31181. I think it's worth having a look at a patch, yes. Thanks Thomas.
comment:8 by , 3 years ago
Cc: | added |
---|
The discussed feature is present in Django==4.1.dev20211119084757 including tests. It is also present in the tag 3.2.9 and 3.2.
For what is the patch then needed? I could do that, but it would be my first contribution to Django whatsoever.
comment:9 by , 3 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I will try to make a patch for this.
comment:10 by , 3 years ago
Do I have to provide a hyperlink to the related object's change page or to the related model's changelist page?
comment:12 by , 3 years ago
Has patch: | set |
---|
comment:13 by , 3 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
comment:14 by , 3 years ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
I have made the required changes. Can someone review the PR?
comment:15 by , 3 years ago
Patch needs improvement: | set |
---|
comment:16 by , 3 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Thanks for this ticket. Can you describe your use case? Do you want to have the same mechanism as the magnifying glass button for
raw_id_fields
?