Commits

Yuriy Netesov committed b7ffe5a

fixed all the methods

  • Participants
  • Parent commits 0c9b4c6

Comments (0)

Files changed (1)

 from models import Poll, Choice
 
 from django.core.serializers import serialize as DjangoSerialize
-from 
 
 def _answer(answer):
-    return HttpResponse(JSONSerializer().serialize(answer))
+    return HttpResponse(answer.json())
 
 def show_polls(request):
     class ShowPollsAnswer:
         def json(self):
             return "{ \"voteresult\" : " + self.voteResult + "}"
 
-    choice = Choice.objects.get(choiceId)
+    choice = Choice.objects.get(pk=choiceId)
     choice.count += 1
     choice.save()
     return HttpResponse(VoteResultAnswer('ok').json())
             self.choices = choices
 
         def json(self):
-            return "{ \"choices\ :" + DjangoSerialize(self.choices) + "}"
+            return "{ \"choices\" :" + DjangoSerialize('json', self.choices) + "}"
 
     pollChoices = Choice.objects.filter(poll__pk=pollId)
     return HttpResponse(PollResultsAnswer(pollChoices).json())