Guest User

Untitled

a guest
Jan 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. def submit_handler(request):
  2. if request.POST:
  3. voting_on = request.POST.get('voting_on').split(',')
  4. for vote_key in voting_on:
  5. vote = Vote.objects.get(pk=vote_key)
  6. vote_value = request.POST.get('vote_%s' % vote_key)
  7. vote.set_vote_value(vote_value)
  8. vote.save()
  9.  
  10. return HttpResponse("THANKS VOR YOUR VOTES")
  11. else:
  12. votes_to_vote_on = Vote.get_votes_for_user(request.user)
  13. return render_to_response('form.html', RequestContext({'votes': votes_to_vote_on}))
Add Comment
Please, Sign In to add comment