diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index dc67262afc..3399bd87b8 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -282,7 +282,7 @@ class AdminSite: path("autocomplete/", wrap(self.autocomplete_view), name="autocomplete"), path("jsi18n/", wrap(self.i18n_javascript, cacheable=True), name="jsi18n"), path( - "r///", + "r///", wrap(contenttype_views.shortcut), name="view_on_site", ), diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index c5d8b8f4f6..3f106f6814 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -8664,6 +8664,19 @@ class AdminViewOnSiteTests(TestCase): ), ) + def test_view_on_site_url_non_integer_ids(self): + """The view_on_site URL accepts non-integer ids.""" + self.assertEqual( + reverse( + "admin:view_on_site", + kwargs={ + "content_type_id": "37156b6a-8a82", + "object_id": "37156b6a-8a83", + }, + ), + "/test_admin/admin/r/37156b6a-8a82/37156b6a-8a83/", + ) + @override_settings(ROOT_URLCONF="admin_views.urls") class InlineAdminViewOnSiteTest(TestCase):