Beispiel #1
0
def log_search(request):
    keyword = request.POST['keyword']
    offset = request.POST['offset']
    if offset == 'offline':
        Login_Info = Login_Record.objects.filter(Q(name__icontains=keyword) | Q(ip__icontains=keyword))
        contact_list,p, contacts, page_range, current_page, show_first, show_end=pages(Login_Info,request)
    if offset == 'file':
        file_record = File_Record.objects.filter(Q(hostname__icontains=keyword) | Q(name__icontains=keyword) | Q(filename__icontains=keyword) | Q(ip__icontains=keyword) | Q(file_type__icontains=keyword))
        contact_list,p, contacts, page_range, current_page, show_first, show_end=pages(file_record,request)
    if offset == 'cmd':
        cmd_info = cmd_record.objects.filter(Q(hostname__icontains=keyword) | Q(name__icontains=keyword) |Q(ip__icontains=keyword) | Q(cmd__icontains=keyword))
        contact_list,p, contacts, page_range, current_page, show_first, show_end=pages(cmd_info,request)
    return render_to_response('log_list_%s.html' % offset, locals())
Beispiel #2
0
def netdev(request):
    all_net_dev = net_dev.objects.all()
    all_idc = Idc.objects.all()
    net_dev_count = net_dev.objects.all().count()
    print    net_dev_count
    contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(all_net_dev, request)
    return    render_to_response('net_dev.html',locals())
Beispiel #3
0
def user_search(request):
    keyword = request.POST['keyword']
    User_info = User.objects.filter(
        Q(username__icontains=keyword) | Q(email__icontains=keyword)
        | Q(is_active__icontains=keyword))
    contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(
        User_info, request)
    return render_to_response('user.html', locals())
Beispiel #4
0
def user(request):
    all_user = User.objects.all()
    contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(
        all_user, request)
    return render_to_response("user.html", locals())
Beispiel #5
0
def asset(request):
    all_asset = ServerAsset.objects.all()
    contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(
        all_asset, request)
    return render_to_response("asset.html", locals())
Beispiel #6
0
def log_list_file(request):
    if request.method == 'GET':
        file_record = File_Record.objects.all().order_by('-id')[0:99]
        contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(
            file_record, request)
        return render_to_response('log_list_file.html', locals())
Beispiel #7
0
def log_list_cmd(request):
    if request.method == 'GET':
        cmd_info = cmd_record.objects.all().order_by('-id')[0:99]
        contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(
            cmd_info, request)
        return render_to_response('log_list_cmd.html', locals())
Beispiel #8
0
def log_list_offline(request):
    if request.method == 'GET':
        Login_Info = Login_Record.objects.all().order_by('-id')[0:99]
        contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(
            Login_Info, request)
        return render_to_response('log_list_offline.html', locals())
Beispiel #9
0
def   mac_search(request):
    print  request.method
    if request.method =='POST':
            all_idc = Idc.objects.all()
            search_word = request.POST.get('keyword')
            print    search_word
            if search_word == '':
                return HttpResponseRedirect('/mac/')
            else:
                all_host = HostList.objects.filter(Q(ip=search_word) |
                                                     Q(hostname=search_word) |
                                                     Q(application=search_word) |
                                                     Q(idc_name=search_word) |
                                                     Q(ip_lan=search_word)|
                                                   Q(fast_server_code=search_word) |
                                                   Q(host_type=search_word) |
                                                   Q(jiekou_status=search_word) |
                                                   Q(os_type=search_word) |
                                                   Q(zicai_code=search_word))
                net_mac_count = all_host.count()
                search=1

                contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(all_host, request)
                return render_to_response('mac.html', locals())
    else:
        return HttpResponseRedirect('/mac/')
Beispiel #10
0
def mac(request):
    all_host = HostList.objects.all().order_by("ip")
    all_idc = Idc.objects.all()
    net_mac_count = all_host.count()
    contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(all_host, request)
    return render_to_response("mac.html",locals(),context_instance=RequestContext(request))
Beispiel #11
0
def  net_search(request):
    if request.method =='POST':
         all_idc = Idc.objects.all()
         search_word=request.POST.get('keyword')
         print    search_word
         if search_word =='':
            return  HttpResponseRedirect('/net_dev/')
         else:
            all_net_dev = net_dev.objects.filter(Q(brand=search_word) |
                                         Q(model_num=search_word) |
                                         Q(type=search_word) |
                                         Q(addr=search_word) |
                                         Q(idc_name=search_word))
            net_dev_count = all_net_dev.count()
            all_idc = Idc.objects.all()
            search=1
            contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(all_net_dev, request)
            return render_to_response('net_dev.html', locals())
    else:
        return HttpResponseRedirect('/net_dev/')