#2076: order_by with related table does not work
---------------------------+------------------------------------------------
Reporter: mtredinnick | Owner: mtredinnick
Status: new | Component: Database wrapper
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
---------------------------+------------------------------------------------
Changes (by mtredinnick):
* status: reopened => new
* stage: Ready for checkin => Accepted
Comment:
This is really great work. Thanks to everybody's who's pitched in so far.
Not quite "ready for checkin" yet because of Ramiro's detective work when
constructing the tests. A few things I would like to see working before
this goes in:
1. Should work with the !Meta inner class as well, since that provides
default ordering for a model and it's going to be the source of a lot of
complaints (from me, no less!) if you can only do something manually and
not automatically.
2. When just specifying a relation field as the ordering attribute, we
should use the related model's "natural" ordering (that specified in Meta)
before primary key ordering. Again, it's the intuitive behaviour when
selecting a model on its own, so making it consistent across the board is
worthwhile.
3. Check it works with all relations (not just !ForeignKeys).
4. Let's work out what happens with backwards relations (and also
spanning across multiple models: does {{{model1__model2__some_field}}}
work?)
I'm not too worried about the backwards-compat issue, since that's a bit
of an ugly hack anyway -- it's the only place you are ever required to
know the database table names (or even care that the database exists) in
the "non-direct-SQL" cases of a !QuerySet. Providing we can get this fixed
before 1.0, I'm willing to defend the case for breaking it in a small way.
The current patch is a great start and looks like the right way to
approach the problem. So if somebody feels enthusiastic and wants to do
some work on this, these are the things I'd like to see done before it can
be checked in.
--
Ticket URL: <http://code.djangoproject.com/ticket/2076#comment:15>
Django Code <http://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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---