I am trying to filter Match
es scheduled in a certain day. I can't just do this:
match_queryset.filter(start=date)
because it also filters by time, but I can do this:
match_queryset.filter(start__year=a_date.year, start__month=a_date.month, start__day=a_date.day)
But this is too complex, I feel like there could be a simpler way.
Then I can also use a range:
t0 = datetime.datetime.combine(a_date, datetime.time(0, 0))
t1 = datetime.datetime.combine(a_date, datetime.time(23, 59, 59))
match_queryset.filter(start__gte=t0, start__lte=t1)
But this just seems to be an overkill and it probably generates an inefficient query.
Can't I just make a query to target the actual date? Something like:
# this of course doesn't work
match_queryset.filter(start__date=date)
No need to say I have tried looking for solution and could not find any.