i have an sql query like this:
select *
from sys_user_promotion_record
where user_id=102 and concat(',' ,vendor_id, ',') like '%,1,%'
how can i make that query into django queryset? so far i manage to make this django queryset:
SysUserPromotionRecord.objects.filter(user_id=102, vendor_id__contains=','+'1'+',')
how can i make concat(',' ,vendor_id, ',')
into django queryset?
i avoid to use raw sql query on my code. Thank you.
This is the vendor_id value sample:
1,11,14
2,1,5
3,5,11
When the sql executed, row 1 and 2 will appear.