def get(self, request): # 判断用户是否登录: login_status = Base.checkUserLogin(request) if login_status: return redirect('/cms/index/') else: return render(request, 'cms/login.html')
def get(self, request): # 检查登录状态 login_status = Base.checkUserLogin(request) if login_status: return render(request, 'cms/index1.html') else: return render(request, 'cms/login1.html')
def get(self, request): # 判断用户是否登录 status = Base.checkUserLogin(request) if status: # 获取ip和时间 ip = Base.get_ip(request) info_time = Base.getNowTime(request) # 将数据传递给前台 context = {'ip': ip, 'info_time': info_time} return render(request, 'cms/index1.html', context=context) else: return render(request, 'cms/login1.html')
def get(self, request): # 判断是或否登录 status = Base.checkUserLogin(request) # 已经登录的情况 if status: ad_name = request.session.get('admin_name') ad_user = Admins.objects.get(admin_name=ad_name) # 获取时间和ip ip = Base.get_ip(request) NowTime = Base.getNowTime(request) # 从传递信息给前台 context = {"ip": ip, "info_time": NowTime, 'ad_user': ad_user} return render(request, 'cms/index.html', context=context) else: return render(request, 'cms/login.html')
def get(self, request): # 判断用户是否登录 admin_id = request.GET.get('id') status_login = Base.checkUserLogin(request) if status_login and admin_id: # # 获取ip和时间 # ip = Base.get_ip(request) # info_time = Base.getNowTime(request) # 根据IP获取用户 admin = Admin.objects.get(pk=admin_id) # 将数据传递前台 context = {'admin': admin} return render(request, 'cms/index.html', locals()) else: request.session.flush() return redirect('/cms/login/')