Example #1
0
def asseterrorlog_list(request):
    if request.method=="GET":
        asset_error_log_objs=models.ErrorLog.objects.select_related().order_by("create_time")
        page_objs=page(request,asset_error_log_objs,page_number=20)
    if request.method=="POST":
        host_ip=request.POST.get("host_ip")
        asset_error_log_objs=models.ErrorLog.objects.filter(asset__host__host_ip=host_ip).select_related().order_by("create_time")
        page_objs=page(request,asset_error_log_objs,page_number=20)
    return render(request,"jasset/asset_error_log_list.html",locals())
Example #2
0
def role_list(request):
    """角色列表"""
    if request.method == "GET":
        role_objs = models.Role.objects.all().order_by("-id")
        page_objs = page(request, role_objs)

    return render(request, "juser/role_list.html", {
        "page_objs": page_objs,
    })
Example #3
0
def menu2_list(request):
    """二级菜单列表"""

    menu2_objs = models.Menu2.objects.all().order_by("-seq")
    page_objs = page(request, menu2_objs)

    return render(request, "juser/menu2_list.html", {
        "page_objs": page_objs,
    })
Example #4
0
def menu_list(request):
    """菜单列表"""
    ret = {"status": True, "data": None, "errors": None}
    menu_objs = models.Menu.objects.all().order_by("-id")
    page_objs = page(request, menu_objs)
    if request.method == "GET":
        menu_add_form_obj = forms.MenuForm()
        if request.is_ajax():
            id = request.GET.get("id")
            menu_obj = models.Menu.objects.filter(id=id).values(
                "id", "name", "seq", "comment")
            ret['data'] = list(menu_obj)
            menu_add_form_obj = forms.MenuForm(menu_obj)
            return HttpResponse(json.dumps(ret))
    if request.method == "POST":
        menu_add_form_obj = forms.MenuForm(request.POST)

    return render(request, "juser/menu_list.html", {
        "page_objs": page_objs,
        "menu_add_form_obj": menu_add_form_obj,
    })
Example #5
0
def host_list(request):
    host_objs = models.Host.objects.select_related()
    page_objs = page(request, host_objs)
    return render(request, "jasset/host_list.html", {"page_objs": page_objs})
Example #6
0
def asset_list(request):
    asset_objs = models.Asset.objects.select_related()
    page_objs = page(request, asset_objs)
    return render(request, "jasset/asset_list.html", {"page_objs": page_objs})
Example #7
0
def user_list(request):
    user_objs = models.UserProfile.objects.all()
    page_objs = page(request, user_objs)
    return render(request, "juser/user_list.html", {"page_objs": page_objs})