django 单点登录思路-装饰器
def the_one(func): '''自定义 验唯一证在线 装饰器''' def check_login_status(request): if request.session.get('qq', None): try: hert = request.session.get('hert', None) data=models.Users.objects.filter(qq=request.session.get('qq',None)).values('business_card').first() if str(hert) == str(data['business_card']): return func(request) else: return redirect('/login/') except: return redirect('/login/') else: return redirect('/login/') return check_login_status