ANDed-ORed query in django -
i want execute following query in django filters out model based on both anded , ored states collectively.
the query in sql this:
select * webreply (conversation_id = conversation_id , (user_id = ids or sent_to = ids))
this wrote in django, throws error saying non-keyword arg after keyword arg django
web_reply_data = webreply.objects.filter(conversation_id = conversation_id, (q(user_id = ids) | q(sent_to = ids)))
where going wrong?
try this:
web_reply_data = webreply.objects.filter(conversation_id = conversation_id).filter( q(user_id = ids) | q(sent_to = ids))
Comments
Post a Comment