示例#1
0
 def save(self):
     newanswer = Answer(text=self.cleaned_data['text'],
                        author=self.cleaned_data['author'])
     newanswer.question = Question.objects.get(
         pk=self.cleaned_data['question'])
     newanswer.save()
     return self.cleaned_data['question']
示例#2
0
    def run(self):
        answer = Answer()
        answer.question = self.question
        answer.user = self.user
        question_title = self.question.title
        question_description = self.question.description

        if USE_SERVER:
            answer_content = self.reuse(question_title, question_description)
            if not answer_content:
                answer_content = self.answer(question_title,
                                             question_description)

            if answer_content:
                answer.answer_text = answer_content
                answer.save()
示例#3
0
文件: forms.py 项目: Adinetti/web
 def save(self, question_id):
     qu = Question.objects.get(pk=question_id)
     answer = Answer(self.cleaned_data['test'])
     answer.question = qu
     answer.save()
示例#4
0
文件: forms.py 项目: delTh/web_tech
 def save(self):
     newanswer = Answer(text=self.cleaned_data['text'], author=self.cleaned_data['author'])
     newanswer.question = Question.objects.get(pk=self.cleaned_data['question'])
     newanswer.save()
     return self.cleaned_data['question']
示例#5
0
文件: forms.py 项目: ExtraALIEN/web
 def save(self):
     ans = Answer(**self.cleaned_data)
     ans.author = self._user
     ans.question = self._question
     ans.save()
     return ans