Commit 2e5b2241 authored by guanghongwei's avatar guanghongwei

л

parent 38445a1d
......@@ -43,7 +43,6 @@ def get_data(data, items, option):
@require_login
def index(request):
path1, path2 = u'仪表盘', 'Dashboard'
users = User.objects.all()
hosts = Asset.objects.all()
online_host = Log.objects.filter(is_finished=0)
......@@ -55,7 +54,6 @@ def index(request):
user_top_ten = week_data.values('user').annotate(times=Count('user')).order_by('-times')[:10]
host_top_ten = week_data.values('host').annotate(times=Count('host')).order_by('-times')[:10]
user_dic, host_dic = get_data(week_data, user_top_ten, 'user'), get_data(week_data, host_top_ten, 'host')
print "##############%s" % request.session.get('role_id')
top = {'user': '活跃用户数', 'host': '活跃主机数', 'times': '登录次数'}
top_dic = {}
......
......@@ -28,4 +28,5 @@ urlpatterns = patterns('juser.views',
(r'^user_edit/$', view_splitter, {'su': user_edit, 'adm': user_edit_adm}),
(r'^profile/$', 'profile'),
(r'^chg_pass/$', 'chg_pass'),
(r'^chg_role/$', 'chg_role'),
)
......@@ -234,6 +234,12 @@ def dept_list_adm(request):
@require_admin
def chg_role(request):
request.session['role_id'] = 0
return HttpResponseRedirect('/')
@require_super_user
def dept_detail(request):
dept_id = request.GET.get('id', None)
......
static/img/root.png

6.42 KB | W: | H:

static/img/root.png

105 KB | W: | H:

static/img/root.png
static/img/root.png
static/img/root.png
static/img/root.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -6,11 +6,15 @@
<a href="/">仪表盘</a>
</li>
<li>
{% if path1 %}
<a>{{ path1 }}</a>
{% endif %}
</li>
{% if path2 %}
<li class="active">
<strong>{{ path2 }}</strong>
</li>
{% endif %}
</ol>
</div>
<div class="col-lg-2">
......
......@@ -10,6 +10,13 @@
<ul class="dropdown-menu animated fadeInRight m-t-xs">
<li><a href="/juser/profile/">个人信息</a></li>
<li><a href="/juser/chg_pass/">修改密码</a></li>
{% ifequal session_role_id 2 %}
<li><a href="/juser/chg_role/">切换普通角色</a></li>
{% endifequal %}
{% ifequal session_role_id 1 %}
<li><a href="/juser/chg_role/">切换普通角色</a></li>
{% endifequal %}
<li class="divider"></li>
<li><a href="/logout/">注销</a></li>
</ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment