Exemplo n.º 1
0
 def submit_voter(self,user,answer,status,evaluation_id=None):
     instance=self.model(user=user,answer=answer,status=status)
     if evaluation_id or evaluation_id==0:
         instance.id=evaluation_id
     instance.save()
     vote_submit_done.send(sender=AnswerEvaluation,instance=instance,user=user,optype="save")
     return instance.id
Exemplo n.º 2
0
 def cancel_vote(self, user, answer, status, evaluation_id):
     instance = self.model(id=evaluation_id, answer=answer, user=user)
     instance.delete()
     vote_submit_done.send(sender=AnswerEvaluation,
                           instance=instance.id,
                           user=user,
                           optype="delete")
Exemplo n.º 3
0
    def cancel_vote(self,user,status):
        if status==1:
            self.answer.favorcount-=1
            self.answer.save()
        else:
            self.answer.opposecount-=1
            self.answer.save()

        vote_submit_done.send(sender=AnswerEvaluation,instance=self.id,user=user,optype="delete")
        self.delete()
Exemplo n.º 4
0
 def submit_voter(self, user, answer, status, evaluation_id=None):
     instance = self.model(user=user, answer=answer, status=status)
     if evaluation_id or evaluation_id == 0:
         instance.id = evaluation_id
     instance.save()
     vote_submit_done.send(sender=AnswerEvaluation,
                           instance=instance,
                           user=user,
                           optype="save")
     return instance.id
Exemplo n.º 5
0
    def cancel_vote(self, user, status):
        if status == 1:
            self.answer.favorcount -= 1
            self.answer.save()
        else:
            self.answer.opposecount -= 1
            self.answer.save()

        vote_submit_done.send(sender=AnswerEvaluation,
                              instance=self.id,
                              user=user,
                              optype="delete")
        self.delete()
Exemplo n.º 6
0
 def submit_vote(self,user,status,is_exists):
     self.status=status
     self.save()
     if status==1:
         if is_exists:
             self.answer.opposecount-=1
         self.answer.favorcount+=1
         self.answer.save()
     else:
         if is_exists:
              self.answer.favorcount-=1
         self.answer.opposecount+=1
         self.answer.save()
     vote_submit_done.send(sender=AnswerEvaluation,instance=self,user=user,optype="save")
Exemplo n.º 7
0
 def submit_vote(self, user, status, is_exists):
     self.status = status
     self.save()
     if status == 1:
         if is_exists:
             self.answer.opposecount -= 1
         self.answer.favorcount += 1
         self.answer.save()
     else:
         if is_exists:
             self.answer.favorcount -= 1
         self.answer.opposecount += 1
         self.answer.save()
     vote_submit_done.send(sender=AnswerEvaluation,
                           instance=self,
                           user=user,
                           optype="save")
Exemplo n.º 8
0
 def cancel_vote(self,user,answer,status,evaluation_id):
     instance=self.model(id=evaluation_id,answer=answer,user=user)
     instance.delete()
     vote_submit_done.send(sender=AnswerEvaluation,instance=instance.id,user=user,optype="delete")