diff options
author | David Sanders <shang.xiao.sanders@gmail.com> | 2022-09-18 01:44:37 +1000 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-10-04 08:19:34 +0200 |
commit | 4771a1694b3b54c7309602820881d3ec9cc2c809 (patch) | |
tree | 68b16c5811caf7d67e1f3425bbedb6e81181ead1 /tests/queries | |
parent | 649b28eab6765cd6b2b40c779a18ecafc99b43d7 (diff) | |
download | django-4771a1694b3b54c7309602820881d3ec9cc2c809.tar.gz |
Fixed #34012 -- Made QuerySet.order_by() apply transforms on related fields for models with Meta.ordering.
This makes QuerySet.order_by() no longer ignore trailing transforms for
models with Meta.ordering. As a consequence, FieldError is raised in
such cases for non-existent fields.
Thanks to Klaas van Schelven for the report and Mariusz Felisiak for the
review and advice.
Diffstat (limited to 'tests/queries')
-rw-r--r-- | tests/queries/models.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/queries/models.py b/tests/queries/models.py index 0e8d6dd174..23c41e3374 100644 --- a/tests/queries/models.py +++ b/tests/queries/models.py @@ -68,6 +68,9 @@ class Annotation(models.Model): class DateTimePK(models.Model): date = models.DateTimeField(primary_key=True, default=datetime.datetime.now) + class Meta: + ordering = ["date"] + class ExtraInfo(models.Model): info = models.CharField(max_length=100) |