7👍
✅
Without more detail into what fields you’re matching it’s hard to be exact, but basically you want to use the |
operator to combine two Q objects.
from django.db.models import Q
result = SomeModel.objects.filter(Q(somefield='foo') | Q(somefield='bar'))
See the docs for full details on Q objects:
https://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects
Source:stackexchange.com