#18165: Ordering by related field creates duplicates in resultant querysets
-------------------------------------+-------------------------------------
     Reporter:  dokterbob            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  1.4
  (models, ORM)                      |               Resolution:  wontfix
     Severity:  Normal               |             Triage Stage:
     Keywords:  ordering,            |  Unreviewed
  duplicates, related                |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * status:  new => closed
 * needs_docs:   => 0
 * resolution:   => wontfix
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Comment:

 I believe this is a known wontfix issue. What you have in the DB is this:
 {{{
 TM - R1 - field = 1
    \
     \
      R2 - field = 2
 }}}
 And what you are trying to do is order TM on the related model's field
 attribute. Note that there are two values for that field, 1 and 2. So, you
 are ordering a single object on two different values! Django's answer to
 this is to return two times the same object. Other option would be to
 throw an error, as there really isn't any correct answer to this situation
 if you want to return one object at a time. The query is allowed because
 when combined with filtering, ordering on reverse-related fields can be
 useful.

 Long story short: wontfix.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18165#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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to