summaryrefslogtreecommitdiff
path: root/tests/invalid_models_tests
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-09-27 12:16:26 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-27 14:22:31 +0200
commit95a11578ce41de1e152fe7d173f109e280aebd6d (patch)
treecb028ad12c6bd88660285a81b94b8839b07d580b /tests/invalid_models_tests
parentc7944628a1979453468d67818c63957532d396d8 (diff)
Fixed #30798 -- Fixed Meta.ordering validation for pk of related fields.
Regression in 440505cb2cadbe1a5b9fba246bcde6c04f51d07e.
Diffstat (limited to 'tests/invalid_models_tests')
-rw-r--r--tests/invalid_models_tests/test_models.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 02db3ea54a..60b89b6f2e 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -844,6 +844,18 @@ class OtherModelTests(SimpleTestCase):
with register_lookup(models.CharField, Lower):
self.assertEqual(Model.check(), [])
+ def test_ordering_pointing_to_related_model_pk(self):
+ class Parent(models.Model):
+ pass
+
+ class Child(models.Model):
+ parent = models.ForeignKey(Parent, models.CASCADE)
+
+ class Meta:
+ ordering = ('parent__pk',)
+
+ self.assertEqual(Child.check(), [])
+
def test_ordering_pointing_to_foreignkey_field(self):
class Parent(models.Model):
pass