#28538: order_with_respect_to not working when model accessed via a many-to-many
related field
-------------------------------------+-------------------------------------
Reporter: Carlos Mermingas | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Carlos Mermingas):
Replying to [comment:1 Tim Graham]:
> Why do you expect ordering on the second query? It's retrieving `Plate`
rather than `MenuPlate`.
Tim, I apologize for the delay in responding. I missed the notification
e-mail when you asked the question.
After better understanding things, I realize that this is not a bug.
In any case, my requirement is to sort plates within a menu. So, I expect
that whenever I get a list of `MenuPlate` objects, they are ordered with
respect to the `Menu` they belong to. Although the second query returns
instances of `Plate`, it is doing so by going (behind the scenes) through
the intermediate model, `MenuPlate`, which defines an ordering. I would
expect this ordering to be used.
Now, if this was the way things worked, I am not sure what should happen
if `MenuPlate` and `Plate` both defined an ordering.
Thank you for taking the time to look into this. If you believe this is
something that merits consideration, I'll be happy to elaborate this
discussion and I'll pay more attention to the notification e-mails.
--
Ticket URL: <https://code.djangoproject.com/ticket/28538#comment:3>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.c41774d08b3fe2cc904d96e959bee6e3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.