#31285: Inherited model doesn't correctly order by "-pk" when specified on
Parent.Meta.ordering
-------------------------------------+-------------------------------------
Reporter: Jon | Owner: nobody
Dufresne |
Type: Bug | Status: new
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Given the following model definition:
{{{
from django.db import models
class Parent(models.Model):
class Meta:
ordering = ["-pk"]
class Child(Parent):
pass
}}}
Querying the `Child` class results in the following:
{{{
>>> print(Child.objects.all().query)
SELECT "myapp_parent"."id", "myapp_child"."parent_ptr_id" FROM
"myapp_child" INNER JOIN "myapp_parent" ON ("myapp_child"."parent_ptr_id"
= "myapp_parent"."id") ORDER BY "myapp_parent"."id" ASC
}}}
The query is ordered `ASC` but I expect the order to be `DESC`.
--
Ticket URL: <https://code.djangoproject.com/ticket/31285>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.31fc33f5e9d06db10fd3595da0ea7e27%40djangoproject.com.