修改bug

pull/6/head
guanghongwei 2015-03-01 15:01:15 +08:00
parent da1beef94d
commit fb1c17dc51
4 changed files with 11 additions and 7 deletions

View File

@ -51,7 +51,7 @@ def perm_list(request):
contacts = paginator.page(current_page)
except (EmptyPage, InvalidPage):
contacts = paginator.page(paginator.num_pages)
return render_to_response('jperm/perm_list.html', locals())
return render_to_response('jperm/perm_list.html', locals(), context_instance=RequestContext(request))
def user_asset_cmd_groups_get(user_groups_select='', asset_groups_select='', cmd_groups_select=''):

View File

@ -111,11 +111,12 @@ def filter_private(group):
@register.filter(name='to_name')
def to_name(user_id):
user = User.objects.filter(id=user_id)
if user:
user = user[0]
return user.name
else:
try:
user = User.objects.filter(id=int(user_id))
if user:
user = user[0]
return user.name
except:
return '非法用户'
@register.filter(name='to_role_name')

View File

@ -50,6 +50,8 @@ def getDaysByNum(num):
li_str.reverse()
t = (li_date, li_str)
return t
def base(request):
return render_to_response('base.html', context_instance=RequestContext(request))

View File

@ -1,7 +1,8 @@
{% load mytags %}
<li class="nav-header">
<div class="dropdown profile-element"> <span>
<img alt="image" class="img-circle" width="64" height="64" src="/static/img/{{ role_id | to_avatar }}.png" />
{# <img alt="image" class="img-circle" width="64" height="64" src="/static/img/{{ role_id | to_avatar }}.png" />#}
<img alt="image" class="img-circle" src="/static/img/profile_small.jpg">
</span>
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<span class="clear"> <span class="block m-t-xs"> <strong class="font-bold">{{ user_id | to_name}}</strong>