I have model containing “caller_name” and “call_datetime” field.
I was able to get number of calls occurred on each day in particular month:
while start_date <= end_date:
calls = CDR.objects.filter(start_time__year=str(start_date.year), start_time__month=str(start_date.month),
start_time__day=str(start_date.day))
print "Number of calls:", len(calls)
start_date = start_date + datetime.timedelta(days=1)
Similarlly, I tried to get number of calls on each hour in particular date.
for i in range(24):
calls = CDR.objects.filter(start_time__year=str(start_date.year), start_time__month=str(start_date.month),start_time__day=str(start_date.day), start_time__hour=str(i))
Found out that “start_time__hour” is not implemented, but in their any way to achieve this?
Try this workaround: