diff --git a/src/back/vote/urls.py b/src/back/vote/urls.py index 4e4ade760..00f333cbe 100644 --- a/src/back/vote/urls.py +++ b/src/back/vote/urls.py @@ -4,18 +4,5 @@ from .views import * urlpatterns = [ - # path('get_for_thn/', GetForThn.as_view(),), - # path('get_for_bst/', GetForBst.as_view(),), - # path('setthanks/', SetThanks.as_view(), name=''), - # path('getthanks/', GetThanks.as_view(), name=''), - # path('setbest/', SetBest.as_view(), name=''), - # path('getbest/', GetBest.as_view(), name=''), - # path('getnotvotethn/', GetNotVoteThn.as_view()), - # path('getnotvotebst/', GetNotVoteBst.as_view()), - - - # path('getvoteinfo/', GetVoteInfo.as_view()), - - - + path('getvotes/', GetVotes.as_view()), ] diff --git a/src/back/vote/views.py b/src/back/vote/views.py index aaab9d67f..44dab44f7 100644 --- a/src/back/vote/views.py +++ b/src/back/vote/views.py @@ -5,4 +5,13 @@ from django.db.models import Q from .models import * from userauth.models import * from .serializers import * +import datetime +class GetVotes(APIView): + + def post(self, request): + now = datetime.datetime.now() + expired_votes = Vote.objects.filter(dateend__lt=now) + active_votes = Vote.objects.filter(dateend__gt=now) + serializer_class = VoteSerializer + return Response('ok')