Esempio n. 1
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
Esempio n. 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
Esempio n. 3
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
Esempio n. 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
Esempio n. 5
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
Esempio n. 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