There is an old thread that didn't end in a resolution about
preventing joins in a filter(foreign_key=None) scenario.

http://groups.google.com/group/django-users/browse_thread/thread/61ee2fb22deae326

I'd like to bring it up again and ask if there is now a way to prevent
joins from a query.

An example:
class Blog(model.Models):
   editor = models.ForeignKey(User, null=True)

# find all the blogs with no editors
>>> Blog.objects.filter(editor=None)
DEBUG:django.db.backends:(0.039) SELECT `myapp_blog`.`id` FROM
`myapp_blog` LEFT OUTER JOIN `myapp_user` ON (`myapp_blog`.`editor_id`
= `myapp_user`.`id`) WHERE `myapp_user`.`id` IS NULL;

# Is there a way to do this query?
>>> Blog.objects.filter(editor=None)
DEBUG:django.db.backends:(0.039) SELECT `myapp_blog`.`id` FROM
`myapp_blog` WHERE `myapp_blog`.`editor_id` IS NULL;

Thanks!
Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to