summaryrefslogtreecommitdiff
path: root/tests/modeladmin
diff options
context:
space:
mode:
authorVytis Banaitis <vytis.banaitis@gmail.com>2016-05-05 20:52:54 +0300
committerTim Graham <timograham@gmail.com>2016-06-04 12:14:02 -0400
commit2f9c4e2b6fab3ce08cfbebff79d758196250790c (patch)
tree550e125782fed8aed39589882c426b9178f78d4e /tests/modeladmin
parent89ca1128840a2ae011109cbf38ea5ee9549f1533 (diff)
Fixed #19963 -- Added support for date_hierarchy across relations.
Diffstat (limited to 'tests/modeladmin')
-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):