Skip to content

Commit

Permalink
optimize code finished
Browse files Browse the repository at this point in the history
  • Loading branch information
guohongze committed Jun 26, 2017
1 parent 0f0dbba commit 7e18563
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions monitor/system.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-

from django.shortcuts import render

# Create your views here.
from django.shortcuts import render_to_response, redirect, RequestContext, HttpResponse
from django.shortcuts import render, HttpResponse
from cmdb.models import Host
from django.contrib.auth.decorators import login_required
from accounts.permission import permission_verify
Expand Down Expand Up @@ -107,7 +103,7 @@ def get_net(request, hostname, timing, net_id):
def index(request):
temp_name = "monitor/monitor-header.html"
all_host = Host.objects.all()
return render_to_response("monitor/index.html", locals(), RequestContext(request))
return render(request, "monitor/index.html", locals())


@login_required()
Expand All @@ -130,6 +126,6 @@ def host_info(request, hostname, timing):
p = len(n["net"])
for x in range(p):
nic_len.append(x)
return render_to_response("monitor/host_info_{}.html".format(timing), locals(), RequestContext(request))
return render(request, "monitor/host_info_{}.html".format(timing), locals())


2 changes: 1 addition & 1 deletion templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<div class="pull-right hidden-xs">
</div>
<!-- Default to the left -->
<a href="http://adminset.cn" target="view_window"></a> AdminSet v0.3.5
<a href="http://adminset.cn" target="view_window"></a> AdminSet v0.3.6
</footer>

0 comments on commit 7e18563

Please sign in to comment.