def test_reverse_person_id(self):
        from elections.writeit_functions import get_api_url_for_person, reverse_person_url
        site = Site.objects.get_current()
        site.domain = 'localhost:8000'
        site.save()

        self.assertEquals(reverse_person_url('http://localhost:8000/api/persons/fiera-feroz'), 'fiera-feroz')
Example #2
0
    def post(self, *args, **kwargs):
        person_id = self.request.POST.get('person_id')
        content = self.request.POST.get('content')

        message_id = self.request.POST.get('message_id')
        try:
            message = VotaInteligenteMessage.objects.get(url=message_id)
            person_id = reverse_person_url(person_id)
            person = Candidate.objects.get(id=person_id)
            VotaInteligenteAnswer.objects.create(person =person, message=message, content=content)
        except Exception, e:
            mail_admins('Error recibiendo una respuesta', e)