diff --git a/bikeshop_project/registration/views.py b/bikeshop_project/registration/views.py index e27bfb1..2a67fe3 100644 --- a/bikeshop_project/registration/views.py +++ b/bikeshop_project/registration/views.py @@ -1,5 +1,6 @@ import json import logging +from datetime import timedelta from django.contrib.auth.decorators import login_required from django.core.urlresolvers import reverse @@ -96,9 +97,10 @@ class MemberSignIn(View): return JsonResponse(data=data, safe=False, status=201) def get(self, request): - start = timezone.now().replace(hour=0, minute=0, second=0, microsecond=0) - end = start.replace(hour=23, minute=59, second=59, microsecond=999999) - visits = Visit.objects.filter(created_at__lte=end, created_at__gte=start).prefetch_related() + start = timezone.now() + end = start + timedelta(hours=4) + visits = Visit.objects.filter(created_at__lte=end, + created_at__gte=start).prefetch_related() serializer = VisitSerializer(visits, many=True) json = JSONRenderer().render(serializer.data)