mirror of
https://github.com/django/django.git
synced 2024-11-21 10:59:04 +01:00
Fixed #35903 -- Made admin's "view on site" URL accept non-integer ContentType pks.
This commit is contained in:
parent
c4614b53d3
commit
ef8ae06c2a
@ -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/<int:content_type_id>/<path:object_id>/",
|
||||
"r/<path:content_type_id>/<path:object_id>/",
|
||||
wrap(contenttype_views.shortcut),
|
||||
name="view_on_site",
|
||||
),
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user