There is a do-it-yourself way
[https://stackoverflow.com/questions/69566447/django-admin-add-hyperlink-
to-related-model Django Admin: Add Hyperlink to related model], but it
would be nice to have declarative solution.
Would you accept a PR which implements this?
--
Ticket URL: <https://code.djangoproject.com/ticket/33267>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "django-admin-hyperlink-to-related-model.png" added.
Old description:
> I would like to add a hyperlink next to the select field of a ForeignKey
>
> There is a do-it-yourself way
> [https://stackoverflow.com/questions/69566447/django-admin-add-hyperlink-
> to-related-model Django Admin: Add Hyperlink to related model], but it
> would be nice to have declarative solution.
>
> Would you accept a PR which implements this?
New description:
I would like to add a hyperlink next to the select field of a ForeignKey
There is a do-it-yourself way
[https://stackoverflow.com/questions/69566447/django-admin-add-hyperlink-
to-related-model Django Admin: Add Hyperlink to related model], but it
would be nice to have declarative solution.
Would you accept a PR which implements this?
https://i.stack.imgur.com/X0VrJ.png
--
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:1>
Old description:
> I would like to add a hyperlink next to the select field of a ForeignKey
>
> There is a do-it-yourself way
> [https://stackoverflow.com/questions/69566447/django-admin-add-hyperlink-
> to-related-model Django Admin: Add Hyperlink to related model], but it
> would be nice to have declarative solution.
>
> Would you accept a PR which implements this?
>
> https://i.stack.imgur.com/X0VrJ.png
New description:
I would like to add a hyperlink next to the select field of a ForeignKey
There is a do-it-yourself way
[https://stackoverflow.com/questions/69566447/django-admin-add-hyperlink-
to-related-model 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?
--
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:2>
* component: Uncategorized => contrib.admin
Comment:
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`?
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:3>
* status: new => closed
* resolution: => needsinfo
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:4>
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:5>
* status: closed => new
* resolution: needsinfo =>
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:6>
* stage: Unreviewed => Accepted
Comment:
Seems similar to b79088306513d5ed76d31ac40ab3c15f858946ea #31181. I think
it's worth having a look at a patch, yes. Thanks Thomas.
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:7>
* cc: Phil (added)
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:8>
* owner: nobody => Shubh Parmar
* status: new => assigned
Comment:
I will try to make a patch for this.
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:9>
Comment (by Shubh Parmar):
Do I have to provide a hyperlink to the related object's change page or to
the related model's changelist page?
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:10>
Comment (by Shubh Parmar):
PR: [https://github.com/django/django/pull/15301]
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:11>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:12>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:13>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* needs_docs: 1 => 0
Comment:
I have made the required changes. Can someone review the PR?
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:14>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:15>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:16>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"11cc227344de06ffd0ad7f07c4e4bdd18851adac" 11cc2273]:
{{{
#!CommitTicketReference repository=""
revision="11cc227344de06ffd0ad7f07c4e4bdd18851adac"
Fixed #33267 -- Added link to related item to related widget wrapper in
admin.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33267#comment:17>