MCPcopy
hub / github.com/django/django / test_custom_admin_site

Method test_custom_admin_site

tests/admin_views/tests.py:9398–9411  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

9396 self.assertIsNone(model_admin.get_view_on_site_url(Worker()))
9397
9398 def test_custom_admin_site(self):
9399 model_admin = ModelAdmin(City, customadmin.site)
9400 content_type_pk = ContentType.objects.get_for_model(City).pk
9401 redirect_url = model_admin.get_view_on_site_url(self.c1)
9402 self.assertEqual(
9403 redirect_url,
9404 reverse(
9405 f"{customadmin.site.name}:view_on_site",
9406 kwargs={
9407 "content_type_id": content_type_pk,
9408 "object_id": self.c1.pk,
9409 },
9410 ),
9411 )
9412
9413 def test_view_on_site_url_non_integer_ids(self):
9414 """The view_on_site URL accepts non-integer ids."""

Callers

nothing calls this directly

Calls 4

ModelAdminClass · 0.90
reverseFunction · 0.90
get_for_modelMethod · 0.80
get_view_on_site_urlMethod · 0.80

Tested by

no test coverage detected