mirror of
https://github.com/django/django.git
synced 2025-11-18 11:00:24 +00:00
Fixed #33077 -- Fixed links to related models for admin's readonly fields in custom admin site.
This commit is contained in:
parent
475cffd1d6
commit
0a9aa02e6f
4 changed files with 19 additions and 6 deletions
|
|
@ -209,7 +209,11 @@ class AdminReadonlyField:
|
|||
remote_field.model._meta.model_name,
|
||||
)
|
||||
try:
|
||||
url = reverse(url_name, args=[quote(remote_obj.pk)])
|
||||
url = reverse(
|
||||
url_name,
|
||||
args=[quote(remote_obj.pk)],
|
||||
current_app=self.model_admin.admin_site.name,
|
||||
)
|
||||
return format_html('<a href="{}">{}</a>', url, remote_obj)
|
||||
except NoReverseMatch:
|
||||
return str(remote_obj)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue