Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
def concern_create(sender, instance, created, **kwargs):
    if created and isinstance(instance, Concern):
        mMs.CounterOperate(instance.ObjectID, 'Collect', '+')
Пример #4
0
def user_create(sender, instance, created, **kwargs):
    if created and isinstance(instance,User): # instance 是一个log对象,里面的user属性才是存储的新建用户对象实例
        if instance.is_superuser:
            mMs.QueryFilterCreate()
Пример #5
0
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', '-')
Пример #6
0
def rollcalldialogue_delete(sender, instance, **kwargs):
    if isinstance(instance, RollCallDialogue):
        mMs.CounterOperate(instance.RollCallID, 'Comment', '-')
        mMs.CounterOperate(instance.Publisher, 'RRCount', '-')
Пример #7
0
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)
Пример #8
0
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)
Пример #9
0
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)
Пример #10
0
def topic_delete(sender, instance, **kwargs):
    if isinstance(instance, TopicInfo):
        mMs.CounterOperate(
            instance.Publisher, 'TCount' if instance.Type == 'Topic' else 'SCount', '-')
Пример #11
0
def CommentAttitude_delete(sender, instance, **kwargs):
    if isinstance(instance, CommentAttitude):
        mMs.CounterOperate(instance.ObjectID, 'Like' if int(instance.Point) == 1 else 'Dislike', '-')
Пример #12
0
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)
Пример #13
0
def userlink_delete(sender, instance, **kwargs):
    if isinstance(instance, UserLink):
        mMs.CounterOperate(instance.UserBeLinked, 'FansCount', '-')
        mMs.CounterOperate(instance.UserLinking, 'FocusCount', '-')
Пример #14
0
def concern_delete(sender, instance, **kwargs):
    if isinstance(instance, Concern):
        mMs.CounterOperate(instance.ObjectID, 'Collect', '-')
Пример #15
0
def rollcall_delete(sender, instance, **kwargs):
    if isinstance(instance, RollCallInfo):
        mMs.CounterOperate(instance.Publisher, 'RCount', '-')
Пример #16
0
def circusee_create(sender, instance, created, **kwargs):
    if created and isinstance(instance, Circusee):
        mMs.CounterOperate(instance.ObjectID, 'Collect', '+')
Пример #17
0
def circusee_delete(sender, instance, **kwargs):
    if isinstance(instance, Circusee):
        mMs.CounterOperate(instance.ObjectID, 'Collect', '-')