How can I update the following query so that I need to remove u like "29" (u__inotcontains="29")?
model1_obj = xx.objects.filter(
date_generated__gte=1429142401,
date_generated__lte=1431648001,
s__icontains="28"
)
How can I update the following query so that I need to remove u like "29" (u__inotcontains="29")?
model1_obj = xx.objects.filter(
date_generated__gte=1429142401,
date_generated__lte=1431648001,
s__icontains="28"
)
You need to use Q objects. Here is the example base on your code.
To exclude it, use
exclude
query. Your can read the details here. The code will be like this.from django.db.models import Q