Filter with multiple conditions on a single related object
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Book End
--
Chapters
00:00 Filter With Multiple Conditions On A Single Related Object
01:14 Answer 1 Score 3
01:28 Accepted Answer Score 4
01:42 Thank you
--
Full question
https://stackoverflow.com/questions/3834...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangoqueryset #djangoorm
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Book End
--
Chapters
00:00 Filter With Multiple Conditions On A Single Related Object
01:14 Answer 1 Score 3
01:28 Accepted Answer Score 4
01:42 Thank you
--
Full question
https://stackoverflow.com/questions/3834...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #djangoqueryset #djangoorm
#avk47
ACCEPTED ANSWER
Score 4
Edit: What you are saying is not correct. The filter() function automatically 'AND's its parameters. See the documentation on filter
ANSWER 2
Score 3
You can use Q objects to handle more complex queries. See django docs about Q objects
from django.db.models import Q
q.filter(
Q(answer__code=code) & Q(answer__value=value)
)