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']
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()
def save(self, question_id): qu = Question.objects.get(pk=question_id) answer = Answer(self.cleaned_data['test']) answer.question = qu answer.save()
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']
def save(self): ans = Answer(**self.cleaned_data) ans.author = self._user ans.question = self._question ans.save() return ans