#2076: order_by with related table does not work
---------------------------+------------------------------------------------
   Reporter:  mtredinnick  |                Owner:  mtredinnick      
     Status:  closed       |            Component:  Database wrapper 
    Version:  SVN          |           Resolution:  duplicate        
   Keywords:  reopen       |                Stage:  Ready for checkin
  Has_patch:  1            |           Needs_docs:  0                
Needs_tests:  0            |   Needs_better_patch:  0                
---------------------------+------------------------------------------------
Comment (by ramiro <rm0 _at_ gmx.net>):

 I will repeat/expand here some thing I've noted when implementing the
 tests so Django developers can take them in account when they decide
 if/when apply this patch:
 
  * The patch allows one to use
 {{{'relationship_name__related_model_field_name'}}} ordering specification
 in the {{{order_by()}}} !QuerySet method but not in the
 {{{Meta.ordering}}} attribute.
  * When you use a bare {{{'relationship_name'}}} ordering specification
 the patch orders things by the related model PK and not by its
 {{{Meta.ordering}}} attribute. By examining the Admin app it seems that at
 least in that app the intent is to do the ordering by {{{Meta.ordering}}}
 if that exists and fallback to the PK otherwise. I don't know if this may
 be considered an inconsistency.
  * I have tested only !ForeignKey relationships.
  * I have not tested if the ordering specification can be used by spanning
 through reverse relationships.
  * The patch does not seem to preserve backwards compatibility with the
 {{{'[-]appname_tablename.fieldname' order_by}}} specification notation
 suggested by the Django documentation
 (http://www.djangoproject.com/documentation/db_api/#order-by-fields).
 Would this be worth noting if the patch gets applied?.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2076#comment:11>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to