def save(self): if self.forum: topic = Topic(forum=self.forum, user=self.user, name=self.cleaned_data['name']) topic.save() #aumentando 5 puntos al user profile############## self.user.get_profile().add_points(5) ################################################## else: topic = self.topic #aumentando 5 puntos al user profile############## self.user.get_profile().add_points(2) ################################################## post = Post(topic=topic, user=self.user, user_ip=self.ip, markup=self.user.forum_profile.markup, body=self.cleaned_data['body']) post.save() if forum_settings.ATTACHMENT_SUPPORT: self.save_attachment(post, self.cleaned_data['attachment']) return post
def save(self): if self.forum: topic = Topic(forum=self.forum, user=self.user, name=self.cleaned_data['name']) topic.save() else: topic = self.topic if self.cleaned_data['subscribe']: # User would like to subscripe to this topic topic.subscribers.add(self.user) post = Post(topic=topic, user=self.user, user_ip=self.ip, markup=self.user.forum_profile.markup, body=self.cleaned_data['body']) post.save() if self.user.groups.filter(name="New Scratchers").exists(): tracking_data = dict(**self.request_data) tracking_data['permalink'] = self.url status = PostStatus.objects.create_for_post(post, **tracking_data) if forum_settings.ATTACHMENT_SUPPORT: self.save_attachment(post, self.cleaned_data['attachment']) return post
def save(self): if self.forum: topic = Topic(forum=self.forum, user=self.user, name=self.cleaned_data['name']) topic.save() else: topic = self.topic post = Post(topic=topic, user=self.user, user_ip=self.ip, markup=self.user.forum_profile.markup, body=self.cleaned_data['body']) post.save() if forum_settings.ATTACHMENT_SUPPORT: self.save_attachment(post, self.cleaned_data['attachment']) return post
def save(self): if self.forum: topic = Topic(forum=self.forum, user=self.user, name=self.cleaned_data['name']) topic.save() else: topic = self.topic if self.cleaned_data['subscribe']: # User would like to subscripe to this topic topic.subscribers.add(self.user) post = Post(topic=topic, user=self.user, user_ip=self.ip, markup=self.user.forum_profile.markup, body=self.cleaned_data['body']) post.save() if forum_settings.ATTACHMENT_SUPPORT: self.save_attachment(post, self.cleaned_data['attachment']) return post