Re: django.db.models.Q for OR lookup is having issues with NULL values

2008-01-02 Thread Malcolm Tredinnick
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: >

django.db.models.Q for OR lookup is having issues with NULL values

2008-01-02 Thread Peter
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