def save(self, commit=False): def grab(s): return self.cleaned_data[s] game = Game.nearest_game() player = Player.user_to_player(self.user, game) self.thread = Thread( game=game, team=grab('team'), title=grab('title'), slug=slugify(grab('title')), ) self.thread.save() post = Post( author=player, thread=self.thread, body=grab('post_body'), created=settings.NOW(), ) if commit: post.save() return self.thread
def save(self, commit=False): post = Post( author=self.player, thread=self.thread, body=self.cleaned_data['body'], created=settings.NOW(), ) if commit: post.save() return post