#7716: select_related() with nullable ForeignKeys screws up when rows actually
have a null value
------------------------------+---------------------------------------------
 Reporter:  miracle2k         |       Owner:  nobody    
   Status:  new               |   Milestone:            
Component:  Database wrapper  |     Version:  SVN       
 Keywords:                    |       Stage:  Unreviewed
Has_patch:  0                 |  
------------------------------+---------------------------------------------
 {{{
 class Review(models.Model):
    author = models.ForeignKey(Person, blank=True, null=True)
 }}}

 {{{
 >>> Review.objects.filter(author__isnull=True)[0].author
 None
 >>>
 Review.objects.select_related('author').filter(author__isnull=True)[0].author
 <type 'exceptions.TypeError'>: coercing to Unicode: need string or buffer,
 NoneType found

 >>> r =
 Review.objects.select_related('author').filter(author__isnull=True)[0]
 >>> type(r.author)
 <class 'proj.app.models.person.Person'>
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7716>
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