mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #30463 -- Fixed crash of deprecation message when Meta.ordering contains expressions.
Regression in 1b1f64ee5a
.
This commit is contained in:
parent
e86cc14bd3
commit
04042b2b44
4 changed files with 15 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue