#10628: RelatedManager and NULL
------------------------------------------+---------------------------------
 Reporter:  anonymous                     |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.1-beta-1
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 My Model:

 {{{
 class Active(models.Model):
  post    = models.ForeignKey(Post, related_name='activeposts')
  rubrica = models.ForeignKey(Rubrica, related_name='activeposts',
 null=True, blank=True)
  type    = models.ForeignKey(Type, related_name='activeposts', null=True,
 blank=True)
 }}}

 Code:
 {{{
 >>> p = Post.objects.get(pk=1206535731)
 >>> p.activeposts.filter(type__pk=2, rubrica__isnull=True)
 }}}

 return empty result. but a have data in database.

 {{{
 >>> p.activeposts.filter(type__exact=2,
 rubrica__isnull=True).query.as_sql()
 ('SELECT `doska_active`.`id`, `doska_active`.`post_id`,
 `doska_active`.`rubrica_id`, `doska_active`.`type_id` FROM `doska_active`
 LEFT OUTER JOIN `doska_rubrica` ON (`doska_active`.`rubrica_id` =
 `doska_rubrica`.`id`) WHERE (`doska_active`.`post_id` = %s  AND
 `doska_active`.`type_id` = %s  AND `doska_rubrica`.`id` IS NULL)',
 (1206535731, 2))
 }}}

 Problem in '''AND `doska_rubrica`.`id` IS NULL'''

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