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