mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #19963 -- Added support for date_hierarchy across relations.
This commit is contained in:
committed by
Tim Graham
parent
89ca112884
commit
2f9c4e2b6f
@@ -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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user