本文整理汇总了Python中models.user.User.update_user方法的典型用法代码示例。如果您正苦于以下问题:Python User.update_user方法的具体用法?Python User.update_user怎么用?Python User.update_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.User
的用法示例。
在下文中一共展示了User.update_user方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_update
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import update_user [as 别名]
def user_update():
values = json.loads(request.form['params'])
try:
numrows = User.update_user(values)
if numrows != 1:
msg = 'Record not updated for unknown reason. Contact admin.'
return jsonify(error=msg)
return jsonify(id=values['id'], users=User.get_users())
except Exception as ex:
return jsonify(error=str(ex))
示例2: get_user
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import update_user [as 别名]
def get_user(id=None):
from models.user import UserSmallForm
if 'logged_in' not in session:
return redirect(url_for('welcome'))
user = User(id=id)
if request.method == 'POST':
user.first_name = request.form.get('first_name', None)
user.last_name = request.form.get('last_name', None)
user.email = request.form.get('email', None)
user.update_user()
user = user.get_by_id()
form = UserSmallForm(obj=user)
schedule = Schedule(uid=id)
schedules = schedule.get_by_logged_user(user.username, timeadapt=True)
return render_template('user.html', user=user, form=form,
schedules=schedules)
示例3: user_update
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import update_user [as 别名]
def user_update():
values = json.loads(request.form['params'])
dao = Dao(stateful=True)
try:
if 'fromPrecinctAdmin' in values:
numrows = User.delete_precinct_admins_for_user(values['id'])
numrows = User.update_user(dao, values)
if numrows != 1:
msg = 'Record not updated for unknown reason. Contact admin.'
return jsonify(error=msg)
if 'precinct_ids' in values:
ids = [int(pid) for pid in values['precinct_ids'].split(',') if pid]
del_ids = list(set(values['prev_precincts']) - set(ids))
add_ids = list(set(ids) - set(values['prev_precincts']))
User.delete_precinct_admins_for_user(dao, values['id'], del_ids)
User.add_precinct_ids(dao, values['id'], add_ids)
users = User.get_users()
return jsonify(users=users)
except Exception as ex:
return jsonify(error=str(ex))
finally:
dao.close()
示例4: trainUserModel
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import update_user [as 别名]
def trainUserModel(self):
user = User(REF_USER_ID, REF_USER_NAME)
for td in self.trainingData:
user.update_user(td)
user.normalize()
self.userData = user
示例5: trainUserModel
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import update_user [as 别名]
def trainUserModel(self):
user = User(REF_USER_ID, self.loc['lat'], self.loc['lon'])
for td in self.trainingData:
user.update_user(td)
user.normalize()
self.userData = user