示例#1
0
文件: views.py 项目: puluto/pangu
def user_edit(id):
	user = User.query.filter(User.id==id).first()
	form = UserEditForm(request.form, user)
	if form.validate_on_submit():
		form.populate_obj(user)
		db.session.commit()
		return redirect(url_for("account.user_list"))
	return render_template('account/user_edit.html', form=form)
示例#2
0
文件: views.py 项目: puluto/pangu
def user_add():
	form = UserEditForm(request.form)
	if form.validate_on_submit():
		user = User()
		form.populate_obj(user)
		db.session.add(user)
		db.session.commit()
		return redirect(url_for("account.user_list"))
	return render_template('account/user_edit.html', form=form)