83
You can use Q objects to do what you want, by bitwise OR-ing them together:
from django.db.models import Q
Publisher.objects.filter(Q(name__contains="press") | Q(country__contains="U.S.A"))
1
Without Q(), you can also run OR
operater as shown below:
Publisher.objects.filter(name__contains="press") | \
Publisher.objects.filter(country__contains="U.S.A")
- [Django]-Count frequency of values in pandas DataFrame column
- [Django]-Django admin: make field editable in add but not edit
- [Django]-Distributed task queues (Ex. Celery) vs crontab scripts
Source:stackexchange.com