def save(self, **kwargs): answer = Answer(**self.cleaned_data) # question_id = re.findall(r'/question/(\d+)/',kwargs['HTTP_REFERER']) answer.author_id = self._user # answer.question_id = int(question_id[0]) answer.save() return answer
def save(self): a = Answer() a.text = self.cleaned_data['text'] #a.author = self._user a.author_id = self._user.pk a.question_id = self.cleaned_data['question'] a.save() return a
def save(self): self.cleaned_data['question'] = Question.objects.get( id=self.cleaned_data['question']) answer = Answer(**self.cleaned_data) answer.author_id = 1 #answer.question = Question.objects.get(id = self.cleaned_data[question]) 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_id = self._user.id answer.save() return answer
def save(self): answer = Answer(**self.cleaned_data) answer.author_id = self._user.id answer.save() return answer
def save(self): ans = Answer(**self.cleaned_data) ans.author_id = self._user.id ans.save()
def save(self): self.cleaned_data['question'] = Question(self.cleaned_data['question']) answer = Answer(**self.cleaned_data) answer.author_id = self.user.id answer.save() return answer