mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #34481 -- Added system check for reverse related fields in ModelAdmin.list_display.
This commit is contained in:
parent
83c9765f45
commit
c813fb327c
3 changed files with 21 additions and 5 deletions
|
@ -537,7 +537,20 @@ class ListDisplayTests(CheckTestCase):
|
|||
self.assertIsInvalid(
|
||||
TestModelAdmin,
|
||||
ValidationTestModel,
|
||||
"The value of 'list_display[0]' must not be a ManyToManyField.",
|
||||
"The value of 'list_display[0]' must not be a many-to-many field or a "
|
||||
"reverse foreign key.",
|
||||
"admin.E109",
|
||||
)
|
||||
|
||||
def test_invalid_reverse_related_field(self):
|
||||
class TestModelAdmin(ModelAdmin):
|
||||
list_display = ["song_set"]
|
||||
|
||||
self.assertIsInvalid(
|
||||
TestModelAdmin,
|
||||
Band,
|
||||
"The value of 'list_display[0]' must not be a many-to-many field or a "
|
||||
"reverse foreign key.",
|
||||
"admin.E109",
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue