Skip to content
Snippets Groups Projects
Commit 7609fabc authored by Calum Mackervoy's avatar Calum Mackervoy
Browse files

Merge branch 'bugfix/adding-missing-response-header' into 'master'

bugfix: adding missing access control allow origin header

See merge request !18
parents 0d32942e dbee3789
No related branches found
No related tags found
1 merge request!18bugfix: adding missing access control allow origin header
Pipeline #7725 passed
......@@ -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!']}},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment