summaryrefslogtreecommitdiff
path: root/tests/modeladmin/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modeladmin/tests.py')
-rw-r--r--tests/modeladmin/tests.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py
index 990ed9ab32..40ea025baf 100644
--- a/tests/modeladmin/tests.py
+++ b/tests/modeladmin/tests.py
@@ -1175,9 +1175,10 @@ class DateHierarchyCheckTests(CheckTestCase):
self.assertIsInvalid(
ValidationTestModelAdmin, ValidationTestModel,
- ("The value of 'date_hierarchy' refers to 'non_existent_field', which "
- "is not an attribute of 'modeladmin.ValidationTestModel'."),
- 'admin.E127')
+ "The value of 'date_hierarchy' refers to 'non_existent_field', which "
+ "does not refer to a Field.",
+ 'admin.E127'
+ )
def test_invalid_field_type(self):
class ValidationTestModelAdmin(ModelAdmin):
@@ -1194,6 +1195,22 @@ class DateHierarchyCheckTests(CheckTestCase):
self.assertIsValid(ValidationTestModelAdmin, ValidationTestModel)
+ def test_related_valid_case(self):
+ class ValidationTestModelAdmin(ModelAdmin):
+ date_hierarchy = 'band__sign_date'
+
+ self.assertIsValid(ValidationTestModelAdmin, ValidationTestModel)
+
+ def test_related_invalid_field_type(self):
+ class ValidationTestModelAdmin(ModelAdmin):
+ date_hierarchy = 'band__name'
+
+ self.assertIsInvalid(
+ ValidationTestModelAdmin, ValidationTestModel,
+ "The value of 'date_hierarchy' must be a DateField or DateTimeField.",
+ 'admin.E128'
+ )
+
class OrderingCheckTests(CheckTestCase):