#26092: Regression when using order_by() on a ManyToManyField using the
'through'
feature
-------------------------------------+-------------------------------------
Reporter: wjakob | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.9
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by akaariai):
I was going to introduce attname for Rel objects, but decided it is safer
to use getattr(field, attname, None) as this will be backpatched. I think
I got the functionality right.
As a side note, a thing to try is to introduce ForeignKey's attname field
as a separate field in the model's meta. This would clean a lot of code.
Instead of having a ForeignKey that also tries to mimic an
integer/text/whatever field, you would have a ForeignKey that defines the
relation, and an Integer/Text/...Field that contains the concrete value
used by the relation. For example, this bug was at least partially caused
by having a ForeignKey represent two different things (the attname check
in compiler is for cases where you want to order by the concrete field
instead of the relation field). Unfortunately changing the representation
of foreign keys will likely be hard to implement in backwards compatible
way. On the other hand, if we get the representation of foreign keys
changed we have solved one of the hardest parts of multicolumn foreign
keys.
--
Ticket URL: <https://code.djangoproject.com/ticket/26092#comment:5>
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/064.c90c7df2231cc2303401e94c9b77650b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.