I would like to retrieve a bunch of rows from my database using a set of filters.
I was wondering if conditional filter is applicable in django. That is, \"filter if
You can chain queries:
user = User.objects.get(pk=1) category = Category.objects.get(pk=1) qs = Item.objects.filter(user=user, date=now()) if category: qs = qs.filter(category=category)
As queryset are executed lazily, DB hit will occur only when you display items.