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:52:08 +0200
commit0dc39ca8677347ecf25aebd056a130cdbfb8df21 (patch)
tree05ae3990a530ee7b00372b933e2c621b13c2ebbb /tests/invalid_models_tests
parentda8f85aa82a8810cac8c0225c1f8862e5d9aea64 (diff)
[3.0.x] Fixed #30798 -- Fixed Meta.ordering validation for pk of related fields.
Regression in 440505cb2cadbe1a5b9fba246bcde6c04f51d07e. Backport of 95a11578ce41de1e152fe7d173f109e280aebd6d from master
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