diff options
| author | Ramiro Morales <ramiro@users.noreply.github.com> | 2018-09-13 13:29:48 -0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-09-13 12:29:48 -0400 |
| commit | 1b1f64ee5a78cc217fead52cbae23114502cf564 (patch) | |
| tree | c6baf64db6c3b7a381fd45639b189ef072e4a960 /tests/ordering | |
| parent | c52ecbda615594750ae59b789313a29893950b3d (diff) | |
Refs #14357 -- Deprecated Meta.ordering affecting GROUP BY queries.
Thanks Ramiro Morales for contributing to the patch.
Diffstat (limited to 'tests/ordering')
| -rw-r--r-- | tests/ordering/tests.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py index 8c07a27428..16e5cc9b2d 100644 --- a/tests/ordering/tests.py +++ b/tests/ordering/tests.py @@ -1,9 +1,10 @@ from datetime import datetime from operator import attrgetter -from django.db.models import DateTimeField, F, Max, OuterRef, Subquery +from django.db.models import Count, DateTimeField, F, Max, OuterRef, Subquery from django.db.models.functions import Upper from django.test import TestCase +from django.utils.deprecation import RemovedInDjango31Warning from .models import Article, Author, OrderedByFArticle, Reference @@ -403,3 +404,11 @@ class OrderingTests(TestCase): articles, ['Article 1', 'Article 4', 'Article 3', 'Article 2'], attrgetter('headline') ) + + def test_deprecated_values_annotate(self): + msg = ( + "Article QuerySet won't use Meta.ordering in Django 3.1. Add " + ".order_by('-pub_date', 'headline') to retain the current query." + ) + with self.assertRaisesMessage(RemovedInDjango31Warning, msg): + list(Article.objects.values('author').annotate(Count('headline'))) |
