mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #14357 -- Made Meta.ordering not affect GROUP BY queries.
Per deprecation timeline.
This commit is contained in:
@@ -3,11 +3,10 @@ from operator import attrgetter
|
||||
|
||||
from django.core.exceptions import FieldError
|
||||
from django.db.models import (
|
||||
CharField, Count, DateTimeField, F, Max, OuterRef, Subquery, Value,
|
||||
CharField, DateTimeField, F, Max, OuterRef, Subquery, Value,
|
||||
)
|
||||
from django.db.models.functions import Upper
|
||||
from django.test import TestCase
|
||||
from django.utils.deprecation import RemovedInDjango31Warning
|
||||
|
||||
from .models import Article, Author, ChildArticle, OrderedByFArticle, Reference
|
||||
|
||||
@@ -481,13 +480,3 @@ class OrderingTests(TestCase):
|
||||
ca4 = ChildArticle.objects.create(headline='h1', pub_date=datetime(2005, 7, 28))
|
||||
articles = ChildArticle.objects.order_by('article_ptr')
|
||||
self.assertSequenceEqual(articles, [ca4, ca2, ca1, ca3])
|
||||
|
||||
def test_deprecated_values_annotate(self):
|
||||
msg = (
|
||||
"Article QuerySet won't use Meta.ordering in Django 3.1. Add "
|
||||
".order_by('-pub_date', F(headline), OrderBy(F(author__name), "
|
||||
"descending=False), OrderBy(F(second_author__name), "
|
||||
"descending=False)) to retain the current query."
|
||||
)
|
||||
with self.assertRaisesMessage(RemovedInDjango31Warning, msg):
|
||||
list(Article.objects.values('author').annotate(Count('headline')))
|
||||
|
||||
Reference in New Issue
Block a user