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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -