mirror of
https://github.com/django/django.git
synced 2025-08-18 17:50:58 +00:00
Fixed #23329 -- Allowed inherited and m2m fields to be referenced in the admin.
Thanks to Trac alias Markush2010 and ross for the detailed reports.
This commit is contained in:
parent
19e6397f82
commit
3cbb7590cb
8 changed files with 79 additions and 5 deletions
|
@ -616,6 +616,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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue