On Mon, Jan 3, 2011 at 7:33 AM, Maxim <smartma...@gmail.com> wrote:

> Here's the snippet of my code:
> Actions.objects.values("context_user").annotate(points =
> Sum("value")).filter(Q(points__gt = limit) | Q(points__lt = -limit))
>
> Note using OR in a filter. But to my surprise the SQL query looks
> like:
> ... GROUP BY "action"."context_user_id" HAVING (SUM("action"."value")
> > 0  AND SUM("action"."value") < 0 )
>
> Somehow Django uses AND instead of OR, thus the result is always
> empty.
>
> Can anyone explain this behavior to me and point out the solution if
> it's not a bug?
>

I think it is a bug, specifically this one:
http://code.djangoproject.com/ticket/11293

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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