def group(request): list = group_list(request) return common.diyrender(request, 'dashboard/system/group.html', { 'list': list, "page": common.page("user/group", list) })
def user_list(request): page = request.POST.get("page", 1) list = User.objects.all() paginator = Paginator(list, 25) list = paginator.get_page(page) # user=User.objects.all() return common.diyrender(request, 'dashboard/system/user.html', { 'list': list, "page": common.page("user/user_list", list) })
def list(request): operation = request.POST.get("type", "user") page = request.POST.get("page", 1) if operation == 'user': list = Demand.objects.filter(user_id=request.user.id).order_by("-like") else: list = Demand.objects.order_by("-like") paginator = Paginator(list, 25) list = paginator.get_page(page) id = [] status = [] if request.user.has_perm("QieGaoWorld.mayor"): status.append(0) if request.user.has_perm("QieGaoWorld.gwh"): status.append(1) if request.user.has_perm("QieGaoWorld.develop"): status.append(2) for i in range(0, len(list)): # list[i].time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(list[i].time)) # user=User.objects.get(id=list[i].user_id) list[i].nickname = id_get_nickname(list[i].user_id) if list[i].status == 0: list[i].status_label = '' list[i].status_text = '待处理' elif list[i].status == 1: list[i].status_label = 'uk-label-success' list[i].status_text = '处理中' elif list[i].status == 2: list[i].status_label = 'uk-label-warning' list[i].status_text = '已完成' elif list[i].status == 3: list[i].status_label = 'uk-label-danger' list[i].status_text = '已拒绝' list[i].like_status = DemandLike.objects.filter( demand_id=list[i].id, user_id=request.session['id']).count() a = {0: '', 1: '', 2: ''} if len(status) > 0: res = Resolution.objects.filter(demand_id=list[i].id, user_id=request.user.id, type__in=status) for r in res: a.update({r.type: r}) list[i].res = a return diyrender( request, 'dashboard/demand/list.html', { 'list': list, "page": common.page("demand/list", list, operation), 'type': operation })
def info(request): id = request.POST.get("id", None) demand = Demand.objects.get(id=id) resolution = ['待处理', '处理中', '已完成', '已拒绝', '市长决议', '糕委会决议', '开发反馈'] demand.status_label = resolution[demand.status] demand.nickname = User.objects.get(id=demand.user_id).nickname res = Resolution.objects.filter(demand_id=demand.id) for i in range(0, len(res)): res[i].type_label = resolution[(res[i].type + 4)] res[i].nickname = User.objects.get(id=res[i].user_id).nickname return diyrender(request, "dashboard/demand/info.html", { "demand": demand, 'resolution': resolution, "res": res })
def index(request, type=None): return diyrender(request, 'dashboard/demand/index.html', {"type": type})