hello, I'm making a little vote system, in wich one can vote an answer, but only once. I have not created a form for the vote, i am creating the vote when someone submits it (accesses a link) How can i make, in my situation, for a person to be able to vote only once? It would be better if i would make a form instead? my code:
def voteup(request,classname, id):
answer = Answer.objects.get(pk = id)
c = Classroom.objects.get(classname = classname)
voted_up_by = Membership.objects.filter(classroom = c).get(member = request.user)
vote = VoteUpAnswer.objects.create(answer = answer, voted_up_by = voted_up_by)
url = reverse('inside_classroom', kwargs={'classname': classname})
return HttpResponseRedirect(url)
thanks!