[Answered ]-Django Q chained queries

2👍

it seems that you are mixing type. is src an int or a string? be consistant.

0👍

You forgot to put a bracket,

-->> ( <<-- (Q(src__lte=4) & Q(src__startswith='2')) | (Q(src__gt=4) & ~Q(src__istartswith='713') & ~Q(src__istartswith='281')))

either you have to remove the last one.

Or you didn’t paste the entire line..

You may want to try this:

(Q(src__gt=4) & !(Q(src__startswith=u'713') | Q(src__startswith=u'281'))

What type of data is your ‘src’? Integer or String?

👤Traian

0👍

Have you tried using ‘and’ instead of ‘&’?

Leave a comment