#12751: order_by after select_related returns empty queryset
---------------------------------------------------+------------------------
          Reporter:  ozguri...@gmail.com           |         Owner:  nobody     
             
            Status:  closed                        |     Milestone:  1.2        
             
         Component:  Database layer (models, ORM)  |       Version:  SVN        
             
        Resolution:  worksforme                    |      Keywords:  order_by, 
select_related
             Stage:  Unreviewed                    |     Has_patch:  0          
             
        Needs_docs:  0                             |   Needs_tests:  0          
             
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Comment (by jashugan):

 I had the same symptoms as this problem. I believe the problem was related
 to a foreign key in the model having the not null constraint, like so:

 {{{
 #!python
 from django.db import models
 import django.contrib.auth.models as auth_m

 class Product(models.Model):
   # by default null is False
   user = models.ForeignKey(auth_m.User)
 }}}

 The database schema, however, had all null values for the user field. The
 query wasn't able to follow the null values for any of the fields, so it
 returned no records.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12751#comment:2>
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 django-upda...@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