def save(self): #topic = Topic(forum=self.article.topic.forum, subject=self.cleaned_data['subject']) #topic.save() f = Forum.objects.get( slug=self.cleaned_data['article_topics']) #.get() #print f topic = Topic(forum=f, subject=self.cleaned_data['subject']) #, is_forum=False) #topic.is_forum = False topic.save() topic.article_set.create( text=self.article.text, filter=self.article.filter, author=self.article.author, guest_name=self.article.guest_name, created=self.article.created, #is_forum=False, ) #self.article.spawned_to = topic #self.article.save() #Article.objects.filter(pk__in=self.cleaned_data['articles']).update(topic=topic) for a in Article.objects.filter( pk__in=self.cleaned_data['articles']).select_related(): topic.article_set.create( text=a.text, filter=a.filter, author=a.author, guest_name=a.guest_name, created=a.created, #is_forum=False, ) return topic
def save(self): topic = Topic(forum=self.article.topic.forum, subject=self.cleaned_data['subject']) topic.save() topic.article_set.create( text=self.article.text, filter=self.article.filter, author=self.article.author, guest_name=self.article.guest_name, created=self.article.created, ) self.article.spawned_to = topic self.article.save() Article.objects.filter(pk__in=self.cleaned_data['articles']).update(topic=topic) return topic
def save(self): topic = Topic(forum=self.forum, subject=self.cleaned_data['subject']) topic.save() return self._save(topic)