summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2026-04-08 09:30:10 -0400
committerJacob Walls <jacobtylerwalls@gmail.com>2026-04-08 13:34:01 -0400
commit280256499c5b2d636949f3c8cb52159a8e4c26bb (patch)
treee275c6e2cef52f557de85d98bbf370ad44950b70 /tests
parentf86eb5f89bc0bd05b407040082d0679feff09090 (diff)
Refs CVE-2026-4292 -- Isolated new test in AdminViewListEditable.
As originally written, this test interfered with admin_views.tests.SeleniumTests.test_inline_uuid_pk_add_with_popup. To fix this, register the new ModelAdmin with a different AdminSite.
Diffstat (limited to 'tests')
-rw-r--r--tests/admin_views/admin.py5
-rw-r--r--tests/admin_views/tests.py2
2 files changed, 4 insertions, 3 deletions
diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
index 26648a1e47..10fccca1a1 100644
--- a/tests/admin_views/admin.py
+++ b/tests/admin_views/admin.py
@@ -369,7 +369,7 @@ class PersonAdmin(admin.ModelAdmin):
return super().get_queryset(request).order_by("age")
-class ParentWithUUIDPKAdmin(admin.ModelAdmin):
+class ParentWithUUIDPKNoAddAdmin(admin.ModelAdmin):
list_display = ("id", "title")
list_editable = ("title",)
@@ -1294,7 +1294,7 @@ site.register(ReferencedByInline)
site.register(InlineReferer, InlineRefererAdmin)
site.register(ReferencedByGenRel)
site.register(GenRelReference)
-site.register(ParentWithUUIDPK, ParentWithUUIDPKAdmin)
+site.register(ParentWithUUIDPK)
site.register(RelatedPrepopulated, search_fields=["name"])
site.register(RelatedWithUUIDPKModel)
site.register(ReadOnlyRelatedField, ReadOnlyRelatedFieldAdmin)
@@ -1373,6 +1373,7 @@ site2.register(Language)
site7 = admin.AdminSite(name="admin7")
site7.register(Article, ArticleAdmin2)
site7.register(Section)
+site7.register(ParentWithUUIDPK, ParentWithUUIDPKNoAddAdmin)
# Admin for testing optgroup in popup response
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 107267b342..532f1e1ea0 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -4742,7 +4742,7 @@ class AdminViewListEditable(TestCase):
"_save": "Save",
}
# This model admin allows no add permissions.
- changelist_url = reverse("admin:admin_views_parentwithuuidpk_changelist")
+ changelist_url = reverse("admin7:admin_views_parentwithuuidpk_changelist")
response = self.client.post(changelist_url, data)
self.assertEqual(response.status_code, HTTPStatus.BAD_REQUEST)
self.assertEqual(ParentWithUUIDPK.objects.count(), before_count)