示例#1
0
文件: views.py 项目: yuzg667/niuforum
    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()
示例#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()
示例#3
0
文件: views.py 项目: niutool/niuforum
 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()
示例#4
0
文件: views.py 项目: niutool/niuforum
 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()