I have Query which shows different results when i use and or &
criteria1 = Q(id__gte=802, id__lte=1000)
criteria2 = Q(country_id__contains='UK')
I always have been using :
q = Mymodel.objects.filter(criteria1 & criteria2)
But in this particular case when i use & it always outputs a single row . (I also checked print q.query(), query comes out to be fine)
However, when i use and instead of &. Query gives correct output
q = Mymodel.objects.filter(criteria1 and criteria2)
what actually is happening under the hood ?