On Wed, 2008-01-02 at 14:25 -0800, Peter wrote:
> I am trying to filter by users who are not staff, but this user column
> accepts NULL values in my model.
> 
> As a result I need to check for user__isnull, since
> user__is_staff=False will not work for null values.
> 
> I tried:
>   Post.objects.filter(Q(user__isnull=True) | Q(user__is_staff=False))
> but this returned nothing, while a plain old:
>   Post.objects.filter(user__isnull=True)
> returns a query set with Post objects.
> 
> I tried rewriting this as a NAND:
>  
> Post.objects.exclude(user__isnull=False).exclude(user__is_staff=True)
> but this didn't work either.
> 
> Is this a bug?

This is basically #2080 (and a number of other variants).

Regards,
Malcolm

-- 
The early bird may get the worm, but the second mouse gets the cheese. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to