Reputation: 4092
I'm trying to filter the query set on between two dates. here is my views.py
week = (startDate, endDate)
Student.objects.filter(created__range=week)
startDate and endDate is date objects
created is my datetime field
but I want filter on only date
i'd like to match the month, day, year exactly, not the time.
expected output is filter queryset between startDate and endDate
Upvotes: 1
Views: 1927
Reputation: 45595
Replace the __range
lookup with __gte
/__lt
combination.
Student.objects.filter(created__gte=startDate,
created__lt=endDate + datetime.timedelta(days=1))
Upvotes: 4