id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 3037,"Q(a=1, b=2) treated as Q(a=1) | Q(b=2)",Andrew McNabb ,nobody,"As far as I can tell from the documentation, arguments to a Q are anded together, e.g. Q(a=1, b=2) is equivalent to Q(a=1) & Q(b=2). However, I am currently finding (in revision 4085) that Q(a=1, b=2) is instead equivalent to Q(a=1) | Q(b=2). In this particular case, I am doing something like: q1 = Q(a=1, b=2) q2 = Q(a=3, b=4) model.objects.filter(q1 | q2) When I look at connection.queries, I find that there is no parenthesization at all, and all of the terms are combined with OR like ""a=1 OR b=2 OR a=3 OR b=4"" instead of ""(a=1 AND b=2) OR (a=3 AND b=4)"". I made my description a little bit abstract for clarity, but I can post the exact queries if necessary. Right now I'm working around the problem by doing something of the form: q1 = Q(a=1) & Q(b=2) etc., which gives the query I expected. I hope this report is clear. Let me know if you have any questions.",defect,closed,"Database layer (models, ORM)",dev,normal,fixed,qs-rf-fixed,,Accepted,0,0,0,0,0,0