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
1#It is worth to note that it's possible to add Q expressions.
2from django.db.models import Q
3
4query = Q(first_name='mark')
5query.add(Q(email='mark@test.com'), Q.OR)
6query.add(Q(last_name='doe'), Q.AND)
7
8queryset = User.objects.filter(query)
9
1import django_filters
2
3class ProductFilter(django_filters.FilterSet):
4 # lookup_expr='iexact'
5 # lookup_expr='icontains'
6 name = django_filters.CharFilter(lookup_expr='iexact')
7
8 class Meta:
9 model = Product
10 fields = ['price', 'release_date']
11