[Fixed]-Django Filter with AND

1👍

Use & for doing AND operations on Q objects.

if user_search != '' and (start_date != '' and end_date != ''):
    items = Order.objects.filter(
         Q(client__email__iexact=user_search) & Q(created_on__range=(start_date, end_date))
        )
    print "items ", items

Leave a comment