def edituser(user_id): user = User.query.get_or_404(user_id) form = UserProfileForm(obj=user, id=user.id) if form.validate_on_submit(): form.Profile_update(user) flash('用户信息更新成功', 'success') return redirect(url_for('admin.users')) return render_template('admin/edit_user.html', form=form, user=user)
def user_profile(): user = User.query.filter_by(id=current_user.id).first() form = UserProfileForm(obj=user, id=user.id) if form.validate_on_submit(): form.Profile_update(user) flash('您的个人资料修改成功!', 'success') return redirect(url_for('front.index')) return render_template('user/profile.html', form=form, user=user)
def user_profile(): user = User.query.filter_by(id=current_user.id).first() form = UserProfileForm(obj=user, id=user.id) if form.validate_on_submit(): file = form.upload_resume_file.data if file: filename = secure_filename(file.filename) file.save(os.path.join('jobplus/static/', 'resume', filename)) user.upload_resume_jobname = filename db.session.add(user) db.session.commit() print(filename) form.Profile_update(user) flash('您的个人资料修改成功!', 'success') return redirect(url_for('front.index')) return render_template('user/profile.html', form=form, user=user)