Python flask_login.current_user.about_me() Examples
The following are 7
code examples of flask_login.current_user.about_me().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
flask_login.current_user
, or try the search function
.
Example #1
Source File: views.py From circleci-demo-python-flask with MIT License | 6 votes |
def edit_profile_admin(id): user = User.query.get_or_404(id) form = EditProfileAdminForm(user=user) if form.validate_on_submit(): user.email = form.email.data user.username = form.username.data user.confirmed = form.confirmed.data user.role = Role.query.get(form.role.data) user.name = form.name.data user.location = form.location.data user.about_me = form.about_me.data db.session.add(user) flash('The profile has been updated.') return redirect(url_for('.user', username=user.username)) form.email.data = user.email form.username.data = user.username form.confirmed.data = user.confirmed form.role.data = user.role_id form.name.data = user.name form.location.data = user.location form.about_me.data = user.about_me return render_template('edit_profile.html', form=form, user=user)
Example #2
Source File: views.py From Simpleblog with MIT License | 6 votes |
def edit_profile(): form = ProfileForm() if form.validate_on_submit(): current_user.nickname = form.nickname.data current_user.about_me = form.about_me.data db.session.add(current_user) flash('更改资料成功。') return redirect(url_for('user.users',nickname=current_user.nickname)) else: form.nickname.data = current_user.nickname form.about_me.data = current_user.about_me return render_template('user/editprofile.html', form=form, title='编辑资料') # 写博客文章
Example #3
Source File: views.py From flasky-first-edition with MIT License | 6 votes |
def edit_profile_admin(id): user = User.query.get_or_404(id) form = EditProfileAdminForm(user=user) if form.validate_on_submit(): user.email = form.email.data user.username = form.username.data user.confirmed = form.confirmed.data user.role = Role.query.get(form.role.data) user.name = form.name.data user.location = form.location.data user.about_me = form.about_me.data db.session.add(user) flash('The profile has been updated.') return redirect(url_for('.user', username=user.username)) form.email.data = user.email form.username.data = user.username form.confirmed.data = user.confirmed form.role.data = user.role_id form.name.data = user.name form.location.data = user.location form.about_me.data = user.about_me return render_template('edit_profile.html', form=form, user=user)
Example #4
Source File: views.py From circleci-demo-python-flask with MIT License | 5 votes |
def edit_profile(): form = EditProfileForm() if form.validate_on_submit(): current_user.name = form.name.data current_user.location = form.location.data current_user.about_me = form.about_me.data db.session.add(current_user) flash('Your profile has been updated.') return redirect(url_for('.user', username=current_user.username)) form.name.data = current_user.name form.location.data = current_user.location form.about_me.data = current_user.about_me return render_template('edit_profile.html', form=form)
Example #5
Source File: routes.py From AUCR with GNU General Public License v3.0 | 5 votes |
def edit_profile(): """Edit profile function allows the user to modify their about me section.""" form = EditProfileForm(current_user.username) if form.validate_on_submit(): current_user.username = form.username.data current_user.about_me = form.about_me.data user_name = User.query.filter_by(username=current_user.username).first() if user_name is None: render_error_page_template(404) if form.otp_token_checkbox.data: if user_name.otp_secret: current_user.otp_secret = user_name.otp_secret else: current_user.otp_secret = pyotp.random_base32() db.session.commit() url = pyqrcode.create(user_name.get_totp_uri()) stream = BytesIO() url.svg(stream, scale=3) return render_template('two-factor-setup.html'), 200, { 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0'} elif request.method == 'GET': form.username.data = current_user.username form.about_me.data = current_user.about_me if form.otp_token_checkbox: if form.otp_token_checkbox.data: form.otp_token.data = current_user.otp_token else: form.otp_token_checkbox = current_user.otp_token_checkbox else: for error in form.errors: flash(str(form.errors[error][0]), 'error') return render_template('edit_profile.html', title=_('Edit Profile'), form=form)
Example #6
Source File: views.py From flasky-first-edition with MIT License | 5 votes |
def edit_profile(): form = EditProfileForm() if form.validate_on_submit(): current_user.name = form.name.data current_user.location = form.location.data current_user.about_me = form.about_me.data db.session.add(current_user) flash('Your profile has been updated.') return redirect(url_for('.user', username=current_user.username)) form.name.data = current_user.name form.location.data = current_user.location form.about_me.data = current_user.about_me return render_template('edit_profile.html', form=form)
Example #7
Source File: routes.py From FlaskQuickStart with Apache License 2.0 | 5 votes |
def edit_profile(): form = EditProfileForm() if form.validate_on_submit(): current_user.username = form.username.data current_user.about_me = form.about_me.data db.session.commit() flash('你的提交已变更.') return redirect(url_for('edit_profile')) elif request.method == 'GET': form.username.data = current_user.username form.about_me.data = current_user.about_me return render_template('edit_profile.html', title='个人资料编辑', form=form)