From the Django documentation:
"Queries for keyword arguments are in the filter (), etc. -" AND "together. If you need to perform more complex queries (for example, queries with OR instructions), you can use Q objects."
from django.db.models import Q
expense.objects.filter(
Q(name__icontains=q) | Q(amount__icontains=q) | Q(category__icontains=q)
)
I'm not sure about the type of quantity and category in your model, so the icons may not work for them.
see this link .
source
share