1from django.db.models import Q
2
3Q(question__startswith='Who') | Q(question__startswith='What')
4
1from django.db.models import Q
2
3obj, created = Person.objects.filter(
4 Q(first_name='Bob') | Q(first_name='Robert'),
5).get_or_create(last_name='Marley', defaults={'first_name': 'Bob'})
6
1#There is Q objects that allow to complex lookups. Example:
2from django.db.models import Q
3
4Item.objects.filter(Q(creator=owner) | Q(moderated=False))
5
1Blog.objects.filter(entry__headline__contains='Lennon').filter(entry__pub_date__year=2008)
2