When the
condition is selected Queryset, filter indicates that =,exclude represents! =.
Queryset.distinct () to repeat
__exact exactly equals like ' aaa '
__iexact exactly equals ignore case ilike ' AAA '
__contains contains The like '%aaa% '
__icontains contains the Ignore case ilike '%aaa% ', but for SQLite, the effect of contains is equivalent to Icontains.
__gt greater than
__gte greater than or equal to
__lt less than
__lte less than or equal to
__in present in a list range
__startswith to ... Start
__istartswith with ... Start ignoring case
__endswith with ... End
__iendswith with ... End, ignoring case
__range in ... Date in range
__year date field
__month Date field month
__day date field Day
__isnull=true/false
Example:
>> q1 = Entry.objects.filter (headline__startswith= "what")
>> q2 = q1.exclude (Pub_date__gte=datetime.date.today () )
>> q3 = Q1.filter (Pub_date__gte=datetime.date.today ())
>>> q = q.filter (pub_date__lte= Datetime.date.today ())
>>> q = q.exclude (body_text__icontains= "food")
that is Q1.filter (pub_date__gte =datetime.date.today ()) indicates that time >=now,q1.exclude (Pub_date__gte=datetime.date.today ()) is represented as <=now
Filter built-in conditions for a Django query set