mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[3.0.x] Fixed #30798 -- Fixed Meta.ordering validation for pk of related fields.
Regression in440505cb2c. Backport of95a11578cefrom master
This commit is contained in:
committed by
Mariusz Felisiak
parent
da8f85aa82
commit
0dc39ca867
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user