summaryrefslogtreecommitdiff
path: root/tests/modeladmin
diff options
context:
space:
mode:
authorTom Carrick <tom@carrick.eu>2023-04-04 15:11:11 +0100
committerNatalia <124304+nessita@users.noreply.github.com>2024-02-05 21:42:04 -0300
commit4ade8386ebfeb7a781dc2b62542c1cf5f8b9ddaf (patch)
tree97263c4f927ad797883bba77db95c6dee6041df4 /tests/modeladmin
parent3580b47ed31ec85ae89b13618f36bb463e97acc8 (diff)
Fixed #10743 -- Allowed lookups for related fields in ModelAdmin.list_display.
Co-authored-by: Alex Garcia <me@alexoteiza.com> Co-authored-by: Natalia <124304+nessita@users.noreply.github.com> Co-authored-by: Nina Menezes <https://github.com/nmenezes0>
Diffstat (limited to 'tests/modeladmin')
-rw-r--r--tests/modeladmin/test_checks.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py
index 73777f05ab..f767a6c92b 100644
--- a/tests/modeladmin/test_checks.py
+++ b/tests/modeladmin/test_checks.py
@@ -69,7 +69,7 @@ class RawIdCheckTests(CheckTestCase):
def test_missing_field(self):
class TestModelAdmin(ModelAdmin):
- raw_id_fields = ("non_existent_field",)
+ raw_id_fields = ["non_existent_field"]
self.assertIsInvalid(
TestModelAdmin,
@@ -602,8 +602,21 @@ class ListDisplayTests(CheckTestCase):
TestModelAdmin,
ValidationTestModel,
"The value of 'list_display[0]' refers to 'non_existent_field', "
- "which is not a callable, an attribute of 'TestModelAdmin', "
- "or an attribute or method on 'modeladmin.ValidationTestModel'.",
+ "which is not a callable or attribute of 'TestModelAdmin', "
+ "or an attribute, method, or field on 'modeladmin.ValidationTestModel'.",
+ "admin.E108",
+ )
+
+ def test_missing_related_field(self):
+ class TestModelAdmin(ModelAdmin):
+ list_display = ("band__non_existent_field",)
+
+ self.assertIsInvalid(
+ TestModelAdmin,
+ ValidationTestModel,
+ "The value of 'list_display[0]' refers to 'band__non_existent_field', "
+ "which is not a callable or attribute of 'TestModelAdmin', "
+ "or an attribute, method, or field on 'modeladmin.ValidationTestModel'.",
"admin.E108",
)