Ìí¼ÓÇл»

pull/6/head
guanghongwei 2015-03-30 21:31:02 +08:00
parent 38445a1dd2
commit 2e5b22417d
7 changed files with 18 additions and 2 deletions

View File

@ -43,7 +43,6 @@ def get_data(data, items, option):
@require_login @require_login
def index(request): def index(request):
path1, path2 = u'仪表盘', 'Dashboard'
users = User.objects.all() users = User.objects.all()
hosts = Asset.objects.all() hosts = Asset.objects.all()
online_host = Log.objects.filter(is_finished=0) 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] 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] 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') 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 = {'user': '活跃用户数', 'host': '活跃主机数', 'times': '登录次数'}
top_dic = {} top_dic = {}

View File

@ -28,4 +28,5 @@ urlpatterns = patterns('juser.views',
(r'^user_edit/$', view_splitter, {'su': user_edit, 'adm': user_edit_adm}), (r'^user_edit/$', view_splitter, {'su': user_edit, 'adm': user_edit_adm}),
(r'^profile/$', 'profile'), (r'^profile/$', 'profile'),
(r'^chg_pass/$', 'chg_pass'), (r'^chg_pass/$', 'chg_pass'),
(r'^chg_role/$', 'chg_role'),
) )

View File

@ -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 @require_super_user
def dept_detail(request): def dept_detail(request):
dept_id = request.GET.get('id', None) dept_id = request.GET.get('id', None)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 105 KiB

View File

@ -6,11 +6,15 @@
<a href="/">仪表盘</a> <a href="/">仪表盘</a>
</li> </li>
<li> <li>
{% if path1 %}
<a>{{ path1 }}</a> <a>{{ path1 }}</a>
{% endif %}
</li> </li>
{% if path2 %}
<li class="active"> <li class="active">
<strong>{{ path2 }}</strong> <strong>{{ path2 }}</strong>
</li> </li>
{% endif %}
</ol> </ol>
</div> </div>
<div class="col-lg-2"> <div class="col-lg-2">

View File

@ -10,6 +10,13 @@
<ul class="dropdown-menu animated fadeInRight m-t-xs"> <ul class="dropdown-menu animated fadeInRight m-t-xs">
<li><a href="/juser/profile/">个人信æ¯</a></li> <li><a href="/juser/profile/">个人信æ¯</a></li>
<li><a href="/juser/chg_pass/">修改密ç </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 class="divider"></li>
<li><a href="/logout/">注销</a></li> <li><a href="/logout/">注销</a></li>
</ul> </ul>