summaryrefslogtreecommitdiff
path: root/tests/ordering/models.py
diff options
context:
space:
mode:
authorruchit2801 <vithaniruchit@gmail.com>2019-05-17 13:00:57 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-05-18 20:05:31 +0200
commitdb7d7901eeacf37f0a6f124e3733c4f121a23e76 (patch)
treea8a2727f352155ae7259cc1fe393de4d0062d8ae /tests/ordering/models.py
parented221f7c97de9781ca5e6dd55a9963dfbe4a89af (diff)
[2.2.x] Fixed #30463 -- Fixed crash of deprecation message when Meta.ordering contains expressions.
Regression in 1b1f64ee5a78cc217fead52cbae23114502cf564. Backport of 04042b2b440f0bf50eb908d52cfe76af430e1738 from master
Diffstat (limited to 'tests/ordering/models.py')
-rw-r--r--tests/ordering/models.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/ordering/models.py b/tests/ordering/models.py
index 85e8c59bb6..8b71983c44 100644
--- a/tests/ordering/models.py
+++ b/tests/ordering/models.py
@@ -14,6 +14,7 @@ undefined -- not random, just undefined.
"""
from django.db import models
+from django.db.models.expressions import OrderBy
class Author(models.Model):
@@ -30,7 +31,12 @@ class Article(models.Model):
pub_date = models.DateTimeField()
class Meta:
- ordering = ('-pub_date', 'headline')
+ ordering = (
+ '-pub_date',
+ 'headline',
+ models.F('author__name').asc(),
+ OrderBy(models.F('second_author__name')),
+ )
def __str__(self):
return self.headline