1👍
✅
You can create a Vote
object with poller_id=poller_id
:
from django.http import JsonResponse
from django.views.decorators.http import require_POST
@require_POST
def submit_vote(request, poller_id):
vote_object = Vote.objects.create(
poller_id=poller_id,
user=request.user,
poller_choice_one_vote=True
)
print('fired vote function')
response_data = 'worked'
return JsonResponse({'response': 'worked'})
Source:stackexchange.com