def CommentAttitude_create(sender, instance, created, **kwargs): if created and isinstance(instance, CommentAttitude): mMs.CounterOperate(instance.ObjectID, 'Like' if instance.Point == 1 else 'Dislike', '+') mMs.AddNotification('CAL' if instance.Point == 1 else 'CAD', instance.ObjectID, instance.Publisher, instance.ObjectID.Publisher) elif (not created) and isinstance(instance, CommentAttitude): mMs.CounterOperate(instance.ObjectID, 'Like' if int(instance.Point) == 1 else 'Dislike', '+') mMs.CounterOperate(instance.ObjectID, 'Like' if abs(int(instance.Point) - 1) == 1 else 'Dislike', '-') mMs.AddNotification('CAL' if instance.Point == 1 else 'CAD', instance.ObjectID, instance.Publisher, instance.ObjectID.Publisher)
def comment_create(sender, instance, created, **kwargs): if created and isinstance(instance, CommentInfo): mMs.CounterOperate(instance.TopicID, 'Comment', '+') mMs.CounterOperate( instance.Publisher, 'TRCount' if instance.TopicID.Type == 'Topic' else 'SRCount', '+') if instance.TopicID.Type == 'Topic': mMs.AddNotification('TCR' if instance.Parent else 'TC', instance, instance.Publisher, instance.Parent.Publisher if instance.Parent else instance.TopicID.Publisher) else: mMs.AddNotification('SCR' if instance.Parent else 'SC', instance, instance.Publisher, instance.Parent.Publisher if instance.Parent else instance.TopicID.Publisher)
def concern_create(sender, instance, created, **kwargs): if created and isinstance(instance, Concern): mMs.CounterOperate(instance.ObjectID, 'Collect', '+')
def user_create(sender, instance, created, **kwargs): if created and isinstance(instance,User): # instance 是一个log对象,里面的user属性才是存储的新建用户对象实例 if instance.is_superuser: mMs.QueryFilterCreate()
def comment_delete(sender, instance, **kwargs): if isinstance(instance, CommentInfo): mMs.CounterOperate(instance.TopicID, 'Comment', '-') mMs.CounterOperate( instance.Publisher, 'TRCount' if instance.Type == 'Topic' else 'SRCount', '-')
def rollcalldialogue_delete(sender, instance, **kwargs): if isinstance(instance, RollCallDialogue): mMs.CounterOperate(instance.RollCallID, 'Comment', '-') mMs.CounterOperate(instance.Publisher, 'RRCount', '-')
def rollcalldialogue_create(sender, instance, created, **kwargs): if created and isinstance(instance, RollCallDialogue): mMs.CounterOperate(instance.RollCallID, 'Comment', '+') mMs.CounterOperate(instance.Publisher, 'RRCount', '+') if not instance.RollCallID.Publisher == instance.Publisher: mMs.AddNotification('RD', instance.RollCallID, instance.Publisher, instance.RollCallID.Target)
def userlink_create(sender, instance, created, **kwargs): if created and isinstance(instance, UserLink): mMs.CounterOperate(instance.UserBeLinked, 'FansCount', '+') mMs.CounterOperate(instance.UserLinking, 'FocusCount', '+') mMs.AddNotification('L', instance, instance.UserLinking, instance.UserBeLinked)
def rollcall_create(sender, instance, created, **kwargs): if created and isinstance(instance, RollCallInfo): mMs.CounterOperate(instance.Publisher, 'RCount', '+') mMs.AddNotification('R', instance, instance.Publisher, instance.Target)
def topic_delete(sender, instance, **kwargs): if isinstance(instance, TopicInfo): mMs.CounterOperate( instance.Publisher, 'TCount' if instance.Type == 'Topic' else 'SCount', '-')
def CommentAttitude_delete(sender, instance, **kwargs): if isinstance(instance, CommentAttitude): mMs.CounterOperate(instance.ObjectID, 'Like' if int(instance.Point) == 1 else 'Dislike', '-')
def topic_create(sender, instance, created, **kwargs): if created and isinstance(instance, TopicInfo): mMs.CounterOperate( instance.Publisher, 'TCount' if instance.Type == 'Topic' else 'SCount', '+') for item in QRC('UserLink.objects.filter(UserBeLinked=%s)', None, instance.Publisher): mMs.AddNotification('TP' if instance.Type == 'Topic' else 'SP', instance, instance.Publisher, item.UserLinking)
def userlink_delete(sender, instance, **kwargs): if isinstance(instance, UserLink): mMs.CounterOperate(instance.UserBeLinked, 'FansCount', '-') mMs.CounterOperate(instance.UserLinking, 'FocusCount', '-')
def concern_delete(sender, instance, **kwargs): if isinstance(instance, Concern): mMs.CounterOperate(instance.ObjectID, 'Collect', '-')
def rollcall_delete(sender, instance, **kwargs): if isinstance(instance, RollCallInfo): mMs.CounterOperate(instance.Publisher, 'RCount', '-')
def circusee_create(sender, instance, created, **kwargs): if created and isinstance(instance, Circusee): mMs.CounterOperate(instance.ObjectID, 'Collect', '+')
def circusee_delete(sender, instance, **kwargs): if isinstance(instance, Circusee): mMs.CounterOperate(instance.ObjectID, 'Collect', '-')