def CheckUserBlockStatus(Object, request): if request.user.is_authenticated: return True if QRC( 'BlackList.objects.filter(Enforceder=%s,Handler=%s)', 0, Object, request.user) else False else: return False
def CheckUserLinkStatus(Object, request): if request.user.is_authenticated: return True if QRC( 'UserLink.objects.filter(UserBeLinked=%s,UserLinking=%s)', 0, Object, request.user) else False else: return False
def CheckTipOffStatus(Object, request): if request.user.is_authenticated: return True if QRC( 'TipOffBox.objects.filter(ObjectID=%s,Publisher=%s)', 0, Object.ObjectID, request.user) else False else: return False
def CheckVoteStatus(type, Object, point, request): if request.user.is_authenticated: return True if QRC( type + 'Attitude.objects.filter(ObjectID=%s,Point=%s,Publisher=%s)', 0, Object.ObjectID, point, request.user) else False else: return False
def SendMail(scene, user): MB = QRC("MailBody.objects.get(Scene=%s)", None, scene) try: CodeNumber = CUD() send_mail( MB.Title, MB.Message, ST.EMAIL_FROM, [ str(user.email), ], html_message=(MB.Html % ('127.0.0.1:8000' if ST.DEBUG else 'www.nagetive.com', user.username, CodeNumber))) RCO('set', TimeOut=60, key=(user.username + '&' + scene), value=CodeNumber) except Exception as e: print(e)
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 CheckCollectStatus(type, Object, request): if request.user.is_authenticated: return True if QRC(type + '.objects.filter(ObjectID=%s,Publisher=%s)', 0, Object, request.user) else False else: return False