def userlist(): if not session.get('name',None): return redirect('/login') fields = ['id','name','name_cn','mobile','email','role','status'] table = 'users' result = user_db.selectAll(fields,table) data = [dict((k,row[i]) for i,k in enumerate(fields)) for row in result] return render_template('userlist.html',users=data,info=session)
def idc(): if not session.get('name',None): return redirect('/login') fields = ['id','name','isp','contact','mobile','address'] table = 'idc' result = user_db.selectAll(fields,table) data = [dict((k,row[i]) for i,k in enumerate(fields)) for row in result] return render_template('idc.html',idcs=data,info=session)
def userlist(): if not session.get('name',None): return redirect('/login') users = [] fields = ['id', 'name', 'name_cn', 'email', 'mobile'] try: role = session['role'] if role != 'admin': condition = 'name = "%s"' % session.get('name',None) result = user_db.selectOne(fields,condition) users = [dict((k,result[i]) for i,k in enumerate(fields))] else: result = user_db.selectAll(fields) users = [dict((k,row[i]) for i,k in enumerate(fields)) for row in result] return render_template('userlist.html', users = users) except: errmsg = "select userlist failed" print traceback.print_exc() return render_template("userlist.html",result=errmsg)
def userlist(): if not session.get('name', None): return redirect('/login') users = [] fields = ['id', 'name', 'name_cn', 'email', 'mobile'] try: role = session['role'] if role != 'admin': condition = 'name = "%s"' % session.get('name', None) result = user_db.selectOne(fields, condition) users = [dict((k, result[i]) for i, k in enumerate(fields))] else: result = user_db.selectAll(fields) users = [ dict((k, row[i]) for i, k in enumerate(fields)) for row in result ] return render_template('userlist.html', users=users) except: errmsg = "select userlist failed" print traceback.print_exc() return render_template("userlist.html", result=errmsg)