diff --git a/tests/model_inheritance/models.py b/tests/model_inheritance/models.py
index a4f9cfe696..f3f1b4a357 100644
a
|
b
|
class Place(models.Model):
|
91 | 91 | def __str__(self): |
92 | 92 | return "%s the place" % self.name |
93 | 93 | |
| 94 | class Meta: |
| 95 | ordering = [models.F('name').desc(nulls_last=True)] |
| 96 | |
94 | 97 | |
95 | 98 | class Rating(models.Model): |
96 | 99 | rating = models.IntegerField(null=True, blank=True) |
diff --git a/tests/ordering/models.py b/tests/ordering/models.py
index 8b71983c44..b8b11de86f 100644
a
|
b
|
class Reference(models.Model):
|
59 | 59 | |
60 | 60 | class Meta: |
61 | 61 | ordering = ('article',) |
| 62 | |
| 63 | |
| 64 | class SubArticle(Article): |
| 65 | pass |
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py
index 18c32d6d5f..39b5a75564 100644
a
|
b
|
from django.db.models.functions import Upper
|
9 | 9 | from django.test import TestCase |
10 | 10 | from django.utils.deprecation import RemovedInDjango31Warning |
11 | 11 | |
12 | | from .models import Article, Author, OrderedByFArticle, Reference |
| 12 | from .models import Article, Author, OrderedByFArticle, Reference, SubArticle |
13 | 13 | |
14 | 14 | |
15 | 15 | class OrderingTests(TestCase): |
… |
… |
class OrderingTests(TestCase):
|
462 | 462 | attrgetter('headline') |
463 | 463 | ) |
464 | 464 | |
| 465 | def test_default_parent_ordering_by_expression(self): |
| 466 | sub1 = SubArticle.objects.create(headline='Sub 1', pub_date=datetime(2005, 7, 26)) |
| 467 | sub2 = SubArticle.objects.create(headline='Sub 2', pub_date=datetime(2005, 7, 27)) |
| 468 | articles = SubArticle.objects.order_by('article_ptr') |
| 469 | self.assertSequenceEqual(articles, [sub2, sub1]) |
| 470 | |
465 | 471 | def test_deprecated_values_annotate(self): |
466 | 472 | msg = ( |
467 | 473 | "Article QuerySet won't use Meta.ordering in Django 3.1. Add " |