Merge pull request #12 from ljjjustin/master

fix user can not get login logs bug
pull/14/head
蓝枫 2015-07-07 17:13:18 +08:00
commit 079338f89d
2 changed files with 8 additions and 8 deletions

View File

@ -484,7 +484,7 @@ def cmd_add(request):
if request.method == 'POST':
name = request.POST.get('name')
dept_id = request.POST.get('dept_id')
cmd = ','.join(request.POST.get('cmd').split('\n'))
cmd = ','.join(request.POST.get('cmd').splitlines())
comment = request.POST.get('comment')
dept = DEPT.objects.filter(id=dept_id)
@ -514,7 +514,7 @@ def cmd_add_adm(request):
if request.method == 'POST':
name = request.POST.get('name')
cmd = ','.join(request.POST.get('cmd').split('\n'))
cmd = ','.join(request.POST.get('cmd').splitlines())
comment = request.POST.get('comment')
try:
@ -552,7 +552,7 @@ def cmd_edit(request):
cmd_group_id = request.POST.get('cmd_group_id')
name = request.POST.get('name')
dept_id = request.POST.get('dept_id')
cmd = ','.join(request.POST.get('cmd').split('\n'))
cmd = ','.join(request.POST.get('cmd').splitlines())
comment = request.POST.get('comment')
cmd_group = CmdGroup.objects.filter(id=cmd_group_id)
@ -751,7 +751,7 @@ def perm_apply_log(request, offset):
header_title, path1, path2 = u'权限申请记录', u'权限管理', u'申请记录'
keyword = request.GET.get('keyword', '')
user_id = get_session_user_info(request)[0]
username = User.objects.get(id=user_id).name
username = User.objects.get(id=user_id).username
dept_name = get_session_user_info(request)[4]
status_dic = {'online': 0, 'offline': 1}
status = status_dic[offset]

View File

@ -812,8 +812,8 @@ def user_detail(request):
if user:
user = user[0]
asset_group_permed = user_perm_group_api(user)
logs_last = Log.objects.filter(user=user.name).order_by('-start_time')[0:10]
logs_all = Log.objects.filter(user=user.name).order_by('-start_time')
logs_last = Log.objects.filter(user=user.username).order_by('-start_time')[0:10]
logs_all = Log.objects.filter(user=user.username).order_by('-start_time')
logs_num = len(logs_all)
return render_to_response('juser/user_detail.html', locals(), context_instance=RequestContext(request))