diff --git a/djangoldp_polls/views.py b/djangoldp_polls/views.py index 37c7631fe6c780c7d58f45dec5d55093e72116d7..750516be5b5a3000198ea06e059cf8fe7a66a355 100644 --- a/djangoldp_polls/views.py +++ b/djangoldp_polls/views.py @@ -16,12 +16,14 @@ class CanVoteOnPollViewSet(APIView): def get(self, request, pk): '''returns True if the user can vote, or False if they have already voted''' + headers = {"Access-Control-Allow-Origin" : request.META.get('HTTP_ORIGIN')} + try: poll = Poll.objects.get(pk=pk) can_vote = True if Vote.objects.filter(relatedPoll=poll, user=request.user).exists(): can_vote = False - return Response(can_vote, status=status.HTTP_200_OK) + return Response(can_vote, status=status.HTTP_200_OK, headers=headers) except Poll.DoesNotExist: return Response(data={'error': {'poll': ['Could not find poll with this ID!']}},