如何将 sql 查询传输到包含&的django orm代码
How to transfer sql query to django orm code which contains &
比如怎么翻译
SELECT id FROM goods WHERE (goods.id & 1) =1
到django orm代码
Goods.objects.extra(where=['id & 1 = 1'])
或
Goods.objects.annotate(flag_fiter=F('id').bitand(1)).filter(flag_fiter=1)
比如怎么翻译
SELECT id FROM goods WHERE (goods.id & 1) =1
到django orm代码
Goods.objects.extra(where=['id & 1 = 1'])
或
Goods.objects.annotate(flag_fiter=F('id').bitand(1)).filter(flag_fiter=1)