#12751: order_by after select_related returns empty queryset
------------------------------------------+---------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone: 1.2
Component: Database layer (models, ORM) | Version: SVN
Keywords: order_by, select_related | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
When querying a model with select_related(), if the related model contains
a field which has null rows, adding the order_by() results in an empty
set. However, count() gives the correct number of records.
Foo.objects.select_related('a__b__c').order_by('x') # returns []
Foo.objects.select_related('a__b__c').order_by('x').count() #returns
correct number
If I fill the null rows with data, the problem vanishes.
This further leads to a "TemplateSyntaxError: 'NoneType' object has no
attribute '_latest_transaction_cache'" in the template.
--
Ticket URL: <http://code.djangoproject.com/ticket/12751>
Django <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.