Exemple #1
0
    def _commit_changes(self, topic, reply, mentioned_user):
        topic.reply_count += 1
        if not topic.reply_reward and topic.reply_count >= 10:
            user_reward(topic.author,
                        settings.REP_TOPIC_REPLY,
                        topic_id=topic.id)
            topic.reply_reward = True
            topic.author.profile.save()

        if mentioned_user:
            for u in mentioned_user:
                data = {}
                data['replier'] = reply.author
                data['topic'] = topic

                detail = render_to_string(
                    "forum/notification/reply_notification.html", data)
                n = Notification(user=u, detail=detail.strip())
                u.profile.has_notification = True
                u.profile.save()
                n.save()

        topic.last_replied = timezone.now()

        reply.save()
        topic.save()
Exemple #2
0
    def _commit_changes(self, topic, mentioned_user):
        topic.save()
        if mentioned_user:
            for u in mentioned_user:
                data = {}
                data['topic'] = topic

                detail = render_to_string("forum/notification/create_topic_notification.html", data)
                n = Notification(user=u, detail=detail.strip())
                u.profile.has_notification = True
                u.profile.save()
                u.save()
                n.save()
Exemple #3
0
 def _commit_changes(self, topic, mentioned_user):
     topic.save()
     
     if mentioned_user:
         for u in mentioned_user:
             data = {}
             data['topic'] = topic
             
             detail = render_to_string("forum/notification/create_topic_notification.html", data)
             n = Notification(user=u, detail=detail.strip())
             u.profile.has_notification = True
             u.profile.save()
             u.save()
             n.save()
Exemple #4
0
 def _commit_changes(self, topic, reply, mentioned_user):
     topic.reply_count += 1
     if not topic.reply_reward and topic.reply_count >= 10:
         user_reward(topic.author, settings.REP_TOPIC_REPLY, topic_id=topic.id)
         topic.reply_reward = True
         topic.author.profile.save()
     
     if mentioned_user:
         for u in mentioned_user:
             data = {}
             data['replier'] = reply.author
             data['topic'] = topic
             
             detail = render_to_string("forum/notification/reply_notification.html", data)
             n = Notification(user=u, detail=detail.strip())
             u.profile.has_notification = True
             u.profile.save()
             n.save()
     
     topic.last_replied = timezone.now()
     
     reply.save()
     topic.save()