def save(self, question_id): question_id = self.cleaned_data.pop('question') q = Question.objects.get(id=question_id) answer = Answer(question=q, **self.cleaned_data) answer.author = self._author answer.save() return answer
def save(self): answer = Answer() answer.author = self._user answer.text = self.cleaned_data['text'] answer.question_id = self.cleaned_data['question'] answer.save() return answer
def save(self, author): data = self.cleaned_data data['question'] = Question.objects.get(pk=data['question']) answer = Answer(**self.cleaned_data) answer.author = author answer.save() return answer
def save(self): answer = Answer(**self.cleaned_data) #t7 user,_ = User.objects.get_or_create(username='******',password='******') #t7 answer.author=user answer.author_id = self._user.id if self._user.id is None: user, _ = User.objects.get_or_create(username='******', password='******') answer.author = user else: pass answer.save() return answer
def save(self): answer = Answer(**self.cleaned_data) answer.author = self._user answer.save() return answer
def save(self): answer = Answer(**self.cleaned_data) if self._user is not None and self._user.is_anonymous() == False: answer.author = self._user answer.save() return answer
def save(self): answer = Answer(**self.cleaned_data) answer.author = self._user answer.save() return answer
def save(self): answer=Answer(**self.cleaned_data) user,_ = User.objects.get_or_create(username='******',password='******') answer.author=user answer.save() return answer
def save(self): ans = Answer(**self.cleaned_data) ans.author = self._user ans.question = self._question ans.save() return ans