@require_role('admin')
def asset_detail(request):
 (header_title, path1, path2) = (u'\u4e3b\u673a\u8be6\u7ec6\u4fe1\u606f', u'\u8d44\u4ea7\u7ba1\u7406', u'\u4e3b\u673a\u8be6\u60c5')
 asset_id = request.GET.get('id', '')
 asset = get_object(Asset, id=asset_id)
 perm_info = get_group_asset_perm(asset)
 log = Log.objects.filter(host=asset.hostname)
 if perm_info:
  user_perm = []
  for (perm, value) in perm_info.items():
   if (perm == 'user'):
    for (user, role_dic) in value.items():
     user_perm.append([user, role_dic.get('role', '')])
   elif ((perm == 'user_group') or (perm == 'rule')):
    user_group_perm = value
 print perm_info
 asset_record = AssetRecord.objects.filter(asset=asset).order_by('-alert_time')
 return my_render('jasset/asset_detail.html', locals(), request)

@ require_role ( 'admin' ) def asset_detail ( request ) : ( header_title , path1 , path2 ) = ( u'\u4e3b\u673a\u8be6\u7ec6\u4fe1\u606f' , u'\u8d44\u4ea7\u7ba1\u7406' , u'\u4e3b\u673a\u8be6\u60c5' ) asset_id = request . GET . get ( 'id' , '' ) asset = get_object ( Asset , id = asset_id ) perm_info = get_group_asset_perm ( asset ) log = Log . objects . filter ( host = asset . hostname ) if perm_info : user_perm = [ ] for ( perm , value ) in perm_info . items ( ) : if ( perm == 'user' ) : for ( user , role_dic ) in value . items ( ) : user_perm . append ( [ user , role_dic . get ( 'role' , '' ) ] ) elif ( ( perm == 'user_group' ) or ( perm == 'rule' ) ) : user_group_perm = value print perm_info asset_record = AssetRecord . objects . filter ( asset = asset ) . order_by ( '-alert_time' ) return my_render ( 'jasset/asset_detail.html' , locals ( ) , request )
asset detail view .