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

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -