예제 #1
0
파일: forms.py 프로젝트: teebes/quanda
 def save(self, *args, **kwargs):
     kwargs['commit'] = False
     profile = super(ProfileForm, self).save(*args, **kwargs)
     profile.bio = strip_js(profile.bio)
     profile.user = self.user
     profile.save()
     return profile
예제 #2
0
 def save(self, *args, **kwargs):
     kwargs['commit'] = False
     profile = super(ProfileForm, self).save(*args, **kwargs)
     profile.bio = strip_js(profile.bio)
     profile.user = self.user
     profile.save()
     return profile
예제 #3
0
파일: forms.py 프로젝트: teebes/quanda
    def save(self, *args, **kwargs):
        kwargs['commit'] = False
        question = super(QuestionForm, self).save(*args, **kwargs)
        
        if self.author.is_authenticated():
            question.author = self.author
        else:
            question.author = User.objects.get(username='******')
        
        question.title = strip_js(question.title)
        question.question_text = strip_js(question.question_text)
        question.last_modified = datetime.datetime.now()
        question.save()

        if self.cleaned_data['tags']:
            question.tags = []
            for tag in self.cleaned_data['tags'].all():
                question.tags.add(tag)
            question.save()

        return question
예제 #4
0
    def save(self, *args, **kwargs):
        kwargs['commit'] = False
        question = super(QuestionForm, self).save(*args, **kwargs)

        if self.author.is_authenticated():
            question.author = self.author
        else:
            question.author = User.objects.get(username='******')

        question.title = strip_js(question.title)
        question.question_text = strip_js(question.question_text)
        question.last_modified = datetime.datetime.now()
        question.save()

        if self.cleaned_data['tags']:
            question.tags = []
            for tag in self.cleaned_data['tags'].all():
                question.tags.add(tag)
            question.save()

        return question
예제 #5
0
파일: forms.py 프로젝트: teebes/quanda
    def save(self, *args, **kwargs):
        kwargs['commit'] = False
        answer = super(AnswerForm, self).save(*args, **kwargs)

        if self.author.is_authenticated():
            answer.author = self.author
        else:
            answer.author = User.objects.get(username='******')
        
        answer.question = self.question
        answer.answer_text = strip_js(answer.answer_text)
        answer.last_modified = datetime.datetime.now()
        answer.save()
        return answer
예제 #6
0
    def save(self, *args, **kwargs):
        kwargs['commit'] = False
        answer = super(AnswerForm, self).save(*args, **kwargs)

        if self.author.is_authenticated():
            answer.author = self.author
        else:
            answer.author = User.objects.get(username='******')

        answer.question = self.question
        answer.answer_text = strip_js(answer.answer_text)
        answer.last_modified = datetime.datetime.now()
        answer.save()
        return answer