summaryrefslogtreecommitdiff
path: root/tests/admin_views/tests.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2014-08-21 11:55:23 -0400
committerSimon Charette <charette.s@gmail.com>2014-08-27 21:27:48 -0400
commit4883516bea2aebff38b193f4c9707928040d0f8a (patch)
tree75cc1778954fa8cd7f8eba216b9477d7e2b90034 /tests/admin_views/tests.py
parent574f8f560fa84474969c1c49a1a38b041e5f016b (diff)
[1.7.x] Fixed #23329 -- Allowed inherited and m2m fields to be referenced in the admin.
Thanks to Trac alias Markush2010 and ross for the detailed reports. Backport of 3cbb7590cb from master
Diffstat (limited to 'tests/admin_views/tests.py')
-rw-r--r--tests/admin_views/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index cf5d22ebd9..03a2974260 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -617,6 +617,15 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
response = self.client.get("/test_admin/admin/admin_views/section/", {TO_FIELD_VAR: 'id'})
self.assertEqual(response.status_code, 200)
+ # Specifying a field referenced by another model though a m2m should be allowed.
+ response = self.client.get("/test_admin/admin/admin_views/m2mreference/", {TO_FIELD_VAR: 'id'})
+ self.assertEqual(response.status_code, 200)
+
+ # Specifying a field that is not refered by any other model directly registered
+ # to this admin site but registered through inheritance should be allowed.
+ response = self.client.get("/test_admin/admin/admin_views/referencedbyparent/", {TO_FIELD_VAR: 'id'})
+ self.assertEqual(response.status_code, 200)
+
# We also want to prevent the add and change view from leaking a
# disallowed field value.
with patch_logger('django.security.DisallowedModelAdminToField', 'error') as calls: