def get(self, request, page): code = request.GET.get('searchCode') # 搜索类型 search_word = request.GET.get('searchWord') if code == '1101': recs = Record.objects.filter(name=search_word) elif code == '1102': recs = Record.objects.filter(tel=search_word) elif code == '1103': recs = Record.objects.filter(qq=search_word) elif code == '1104': recs = Record.objects.filter(email=search_word) else: return render(request, 'msgSearch.html', {'msg': '必须根据条件查询'}) #money_sum = recs.filter(state=True).aggregate(Sum('money')) money_sum = 0 for i in recs: if i.state: money_sum+=i.money typeobj = LotteryClass.objects.all() context = fenye(recs, page) context['money_sum'] = money_sum context['typeobj'] = typeobj context['searchCode'] = code context['searchWord'] = search_word context['pms'] = request.session['munu_list'] if not recs: context['pms'] = request.session['munu_list'] context['msg'] = '没有数据' return render(request, 'msgSearch.html', context)
def get(self, request, page): groups = AdminGroup.objects.all().order_by('id') context = fenye(groups, page, 8) for i in context['pageobjs']: i.pmsions = [i.name for i in i.permission.all()] # 该组的所有权限 i.count = i.group_user.count() context['pms'] = request.session['munu_list'] return render(request, 'group.html', context)
def get(self, request, page): searchword = request.GET.get('searchword') if not searchword: return render(request, 'uploadRecord.html', {'msg': '请输入搜索词'}) search_data = Upload.objects.filter( Q(dataname__icontains=searchword) | Q(filename__icontains=searchword) | Q(Q(bywho__icontains=searchword))) context = fenye(search_data, page) context['searchword'] = searchword context['pms'] = request.session['munu_list'] return render(request, 'uploadRecordSearch.html', context)
def get(self, request, page): group_objs = AdminGroup.objects.all() # 展示管理员和下拉组 users = User.objects.all().order_by('id') context = fenye(users, page, 5) for user_obj in context['pageobjs']: login_last = LoginRecord.objects.filter(name=user_obj.username).last() # 最后的登录记录 group = AdminGroup.objects.filter(group_user=user_obj).last() # 用户所在组 user_obj.last_time = login_last.create_time if login_last else '' # 最后登陆的时间 user_obj.last_ip = login_last.ip if login_last else '' # 最后登陆ip user_obj.group = group.name if group else '' # 所属管理组 user_obj.group_id = group.id if group else '' # 管理组id context["group_data"] = group_objs context['pms'] = request.session['munu_list'] return render(request, 'mdfuser.html', context)
def get(self, request, page): search_word = request.GET.get('search') login_recs = LoginRecord.objects.filter(name=search_word).order_by('-create_time') if login_recs.exists(): context = fenye(login_recs, page) context['search_word'] = search_word context['pms'] = request.session['munu_list'] else: context = { "msg": "没有该用户记录" } context['pms'] = request.session['munu_list'] return render(request, 'LoginRecordSearch.html', context) context['pms'] = request.session['munu_list'] return render(request, 'LoginRecordSearch.html', context)
def get(self, request, page): startTime = request.GET.get('startTime') endTime = request.GET.get('endTime') username = request.GET.get('username') if username != '0': # 选择某个用户的记录 records = Record.objects.filter(send_time__range=(startTime, endTime + ' 23:59:59'), operator=username) else: records = Record.objects.filter(send_time__range=(startTime, endTime + ' 23:59:59')) userobjs = User.objects.all() context = fenye(records, page, 5) context['status'] = 1 context['userobjs'] = userobjs context['startTime'] = startTime context['endTime'] = endTime context['username'] = username context['pms'] = request.session['munu_list'] return render(request, 'managelog.html', context)
def get(self, request, page): classobj = LotteryClass.objects.all().order_by('id') context = fenye(classobj, page, 8) context['pms'] = request.session['munu_list'] return render(request, 'typeManage.html', context)
def get(self, request, page): uploads = Upload.objects.all().order_by('-id') context = fenye(uploads, page) context['pms'] = request.session['munu_list'] context['msg']='' return render(request, 'uploadRecord.html', context)
def get(self, request, page): login_recs = LoginRecord.objects.all().order_by('-create_time') context = fenye(login_recs, page) context['pms'] = request.session['munu_list'] return render(request, 'loginRecord.html', context)