#30460: ManyToMany relationships with a custom `through` do not respect
Meta.ordering on the intermediary model
-------------------------------------+-------------------------------------
     Reporter:  ryanpetrello         |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  2.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1
 * type:  Bug => New feature
 * stage:  Unreviewed => Accepted


Comment:

 I wouldn't say this is actually a bug as many-to-many field managers have
 always supported ordering on their referenced model

 Adding support for `through._meta.ordering` has backward compatibility
 concerns as we have to decide how to deal with `ordering` defined on both
 the `through` and `to` model. Should the `through` ordering have
 precedence over the `to`ordering? Should they be merged together? We also
 have to make sure whatever we do regarding ordering translation honors the
 mechanisms in place to exclude `Meta.ordering` from aggregation as naively
 translating it into an `order_by` call will bypass the checks added in
 1b1f64ee5a78cc217fead52cbae23114502cf564 for #14357.

 In my opinion the resulting ordering should be `through._meta.ordering` +
 `to._meta.ordering`. This might require a django-developers thread to
 gather feedback though.

 Accepting the ticket on the basis that it seems like a feature that should
 be supported but the current PR requires significant adjustments first.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30460#comment:1>
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/070.ce1c51662c09b62769125e9a18aee9fe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to