def make_children(self, parent_story, top_story, parent_comment=None): for story in Story.objects.filter(parent=parent_story): comment = ThreadedComment() comment.content_object = top_story if parent_comment: comment.parent = parent_comment comment.user = story.user comment.submit_date = story.created comment.update_date = story.updated comment.content = story.content comment.site_id = 1 if not comment.content: comment.content = "BLANK" comment.save() print " " * comment.level, print comment.user self.make_children(story, top_story, comment)
def make_children(self, parent_debate, forum_top, parent_comment=None): for debate in Debate.objects.filter(parent=parent_debate): #comment = ThreadedComment.objects.get_or_create(user=debate.user, submit_date=debate.created, update_date=debate.updated, defaults={'content_type_id': 1, 'site_id': 1}) comment = ThreadedComment() comment.content_object = forum_top if parent_comment: comment.parent = parent_comment comment.user = debate.user comment.submit_date = debate.created comment.update_date = debate.updated comment.content = debate.content comment.site_id = 1 if not comment.content: comment.content = "BLANK" comment.save() print " " * comment.level, print comment.user self.make_children(debate, forum_top, comment)