P-94
This commit is contained in:
1 parent
3198abd6b1
commit
10768b2228
1 file changed
+17
@@ -45,6 +45,23 @@ class GetVotes(APIView):
|
||||
)
|
||||
vote.save()
|
||||
|
||||
def get_vote(self, request):
|
||||
vote_id = request.query_params.get('id')
|
||||
try:
|
||||
vote = Vote.objects.get(id=vote_id)
|
||||
vote_data = {
|
||||
'id': vote.id,
|
||||
'name': vote.name,
|
||||
'description': vote.description,
|
||||
'datestart': vote.datestart,
|
||||
'dateend': vote.dateend,
|
||||
'settings': vote.settings,
|
||||
'author': vote.author.username,
|
||||
}
|
||||
return Response({'status': 'success', 'vote': vote_data}, status=200)
|
||||
except:
|
||||
return Response({'error': 'Vote not found'}, status=404)
|
||||
|
||||
def update_vote(self, request):
|
||||
vote_id = request.data.get('id')
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user