本文整理汇总了Python中user.User.longname方法的典型用法代码示例。如果您正苦于以下问题:Python User.longname方法的具体用法?Python User.longname怎么用?Python User.longname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.longname方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: manage_users_edit
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import longname [as 别名]
def manage_users_edit(name=None):
if request.method == 'GET':
error = None
u = User()
u.name = name
u = get_user(u)
if u is None:
error = "User existiert nicht"
return render_template('manage_users_edit.html', user_to_edit=u, error=error, user=get_user_by_name(session.get('name')))
if request.method == 'POST':
u = User()
#print request.form
u.id = request.form['id']
u.name = request.form['username'].lower()
u.longname=request.form['longname']
u.email = request.form['email']
u.rfid_id = request.form['rfid_id']
if 'isblack' in request.form:
u.isblack = True
else:
u.isblack = False
if 'isbaron' in request.form:
u.isbaron = True
else:
u.isbaron = False
if 'isshown' in request.form:
u.isshown = True
else:
u.isshown = False
if 'autoblack' in request.form:
u.autoblack = True
else:
u.autoblack = False
if 'onlyrfid' in request.form:
u.onlyrfid = True
else:
u.onlyrfid = False
u2 = get_user_by_id(u.id)
u.password = u2.password
update_user(u)
return redirect('/manage_users')
示例2: get_user_by_id
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import longname [as 别名]
def get_user_by_id(id):
row = query_db("SELECT * FROM USERS WHERE ID = ?", [id], one=True)
u = User()
if row is None:
return None
u.id=row[0]
u.name=row[1]
u.password=row[2]
u.longname=row[3]
u.email=row[4]
u.isblack=row[5]
u.isbaron=row[6]
u.isshown=row[7]
u.autoblack=row[8]
u.onlyrfid=row[9]
u.rfid_id = get_rfid_ids_by_userid(u.id)
logging.debug(u)
return u
示例3: get_users
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import longname [as 别名]
def get_users():
rows = query_db("SELECT * FROM USERS")
users = []
for row in rows:
u = User()
u.id=row[0]
u.name=row[1]
u.password=row[2]
u.longname=row[3]
u.email=row[4]
u.isblack=row[5]
u.isbaron=row[6]
u.isshown=row[7]
u.autoblack=row[8]
u.onlyrfid=row[9]
u.rfid_id = get_rfid_ids_by_userid(u.id)
users.append(u)
return users
示例4: manage_users_add
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import longname [as 别名]
def manage_users_add():
if request.method == 'POST':
u = User()
error = None
u.name = request.form['username'].lower()
if u.name is None:
error = "Username not unique!"
if request.form['password1'] == request.form['password2']:
#u.password = request.form['password1']
u.password = bcrypt.hashpw(request.form['password1'], bcrypt.gensalt())
else:
error = "Passwords do not match!"
u.longname = request.form['longname']
u.email = request.form['email']
u.rfid_id = request.form['rfid_id']
if error is None:
add_user(u)
return render_template('manage_users_add.html', success="User created!", user=get_user_by_name(session.get('name')));
return render_template('manage_users_add.html', error=error, user=get_user_by_name(session.get('name')))
return render_template('manage_users_add.html', user=get_user_by_name(session.get('name')))