Beispiel #1
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
    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="Edit Profile",
                           form=form)
Beispiel #2
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    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('main.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', form=form, title=_('Редактировать профиль'))
Beispiel #3
0
def edit_profile(username):
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash(_('Your profile has been updated.'))
        return redirect(url_for('main.user', username=current_user.username))
    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=_('Edit Profile'), form=form)
Beispiel #4
0
def profile():
    form = EditProfileForm(current_user.username)
    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('main.profile'))
    elif request.method == 'GET':
        form.username.data = current_user.username
        form.about_me.data = current_user.about_me
    return render_template('profile.html', title=_('个人资料编辑'), form=form)
Beispiel #5
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        db.session.commit()
        flash('Your changes have been saved.')
        return redirect(url_for('main.edit_profile'))
    elif request.method == 'GET':
        current_user.username = current_user.username
    return render_template('edit_profile.html',
                           title='Edit Profile',
                           form=form)
Beispiel #6
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    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('main.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', form=form )
Beispiel #7
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data.lower()
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash("Your changes have been saved")
        return redirect(url_for("main.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="Edit Profile", form=form)
Beispiel #8
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        update_user_profile(current_user, form.username.data,
                            form.about_me.data)
        flash(_("Your changes have been saved."))
        return redirect(url_for("main.user", username=current_user.username))
    form.username.data = current_user.username
    form.about_me.data = current_user.about_me
    return render_template("main/edit_profile.html",
                           title=_("Edit Profile"),
                           form=form)
Beispiel #9
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash('Your changes are successfully saved')
        return redirect(url_for('main.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', form=form)
Beispiel #10
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.update_profile(form.username.data, form.about_me.data)
        flash(_('Your changes have been saved.'))
    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=_('Edit Profile'),
                           form=form)
Beispiel #11
0
def edit():
    form = EditProfileForm(current_user.username)
    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("main.edit"))
    elif request.method == "GET":
        form.username.data = current_user.username
        form.about_me.data = current_user.about_me
    return render_template("main/edit_profile.html", form=form)
Beispiel #12
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()  # pylint: disable=no-member
        flash(_('Your changes have been saved.'))
        return redirect(url_for('main.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=_('Edit Profile'), form=form)
Beispiel #13
0
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()
        return render_template(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('main/edit_profile.html',
                           title='Edit Profile',
                           form=form)
Beispiel #14
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit(): # 如果验证成功,则是正确提交的内容,直接存入数据库
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash(_('Your changes have been saved.'))
        return redirect(url_for('main.edit_profile'))
    elif request.method == 'GET': # 如果是GET请求,则是第一次请求,获取默认的内容并返回页面输入
        form.username.data = current_user.username
        form.about_me.data = current_user.about_me
    # 否则,验证失败且是POST请求,则直接返回原页面重新输入
    return render_template('edit_profile.html', title=_('Edit Profile'), form=form)
Beispiel #15
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if request.method == "POST":
        current_user.about_me = request.form['about_me']
        db.session.commit()

        # flash(_('Your changes have been saved.'))
    #     return redirect(url_for('main.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=_('Edit Profile'),
                           form=form)
Beispiel #16
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash(_('Vos informations ont été modifiées'))
        return redirect(url_for('main.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=_('Modifier Profile'),
                           form=form)
Beispiel #17
0
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('main.user', username=current_user.username))
    form.name.data = current_user.name
    form.location.data = current_user.location
    form.about_me = current_user.about_me
    return render_template('edit_profile.html', form=form)
Beispiel #18
0
def edit_profile():
    form = EditProfileForm()
    if form.validate_on_submit():
        current_user.name = form.name.data
        current_user.class_info = form.class_info.data
        current_user.about_me = form.about_me.data
        db.session.add(current_user)
        flash('信息已被更新.')
        return redirect(url_for('.user', username=current_user.username))
    form.name.data = current_user.name
    form.class_info.data = current_user.class_info
    form.about_me.data = current_user.about_me
    return render_template('edit_profile.html', form=form)
Beispiel #19
0
def edit_profile():
    form = EditProfileForm(current_user.user_name)
    if form.validate_on_submit():
        current_user.user_name = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash('Your changes have been saved...')
    elif request.method == 'GET':
        form.username.data = current_user.user_name
        form.about_me.data = current_user.about_me
    return render_template('main/edit_profile.html',
                           title='Edit Profile',
                           form=form)
Beispiel #20
0
def edit_profile():
    # Pass in original username to validate renames
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash(_('Your changes have been save.'))
        return redirect(url_for('main.edit_profile'))
    # Pre-populate form with current values:
    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=_('Edit Profile'), form=form)
Beispiel #21
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash('Le modifiche sono state salvate.')
        return redirect(url_for('main.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='Modifica profilo',
                           form=form)
Beispiel #22
0
def edit_profile():
    """个人资料视图"""

    form = EditProfileForm(current_user.username)
    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('main.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)
Beispiel #23
0
def edit_profile():
    """Edit user profile view controller"""
    title = 'Edit User Profile'
    form = EditProfileForm(current_user)

    if form.validate_on_submit():
        if form.username.data != current_user.username:
            current_user.username = form.username.data

        current_user.about_me = form.about_me.data
        db.session.commit()
        return redirect(url_for('main.user', username=current_user.username))

    return render_template('main/edit_profile.html', title=title, form=form)
Beispiel #24
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    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('main.edit_profile'))
    elif request.method == 'GET':
        form.username.data = current_user.username
        form.about_me.data = current_user.about_me
    else:
        pass
    return render_template('edit_profile.html', title=_('编辑个人页面'), form=form)
Beispiel #25
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.user_info = form.about_user.data
        db.session.commit()
        flash('Succesfully updated')
        return redirect(url_for('main.edit_profile'))
    elif request.method == 'GET':
        form.username.data = current_user.username
        form.about_user.data = current_user.user_info
    return render_template('edit_profile.html',
                           title='Edit Profile',
                           form=form)
Beispiel #26
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.about_me = form.about_me.data
        db.session.commit()
        flash(_("Your profile has been updated!"))
        return redirect(url_for("main.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=_("Edit Profile"),
                           form=form)
Beispiel #27
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    if form.validate_on_submit():
        current_user.username = form.username.data
        current_user.remindings = form.remindings.data
        db.session.commit()
        flash(_l("Your changes have been saved."))
        return redirect(url_for('main.edit_profile'))
    elif request.method == 'GET':
        form.username.data = current_user.username
        form.remindings.data = current_user.remindings
        return render_template('edit_profile.html',
                               title=_l("Edit Profile"),
                               form=form)
Beispiel #28
0
def edit_profile():
  form = EditProfileForm()
  if form.validate_on_submit():
    current_user.about_me = form.about_me.data
    db.session.commit()
    flash('Your changes have been saved.')
    return redirect(url_for('main.user', 
                            username=current_user.username,
                            title="{}'s User Page".format(
                                  current_user.displayname)))
  elif request.method == "GET":
    form.about_me.data = current_user.about_me
  return render_template('edit_profile.html', title='Edit Profile', 
                         form=form)
Beispiel #29
0
def edit_profile():
    form = EditProfileForm(current_user.username)
    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('main.edit_profile'))
    elif request.method == 'GET':
        # 如果为 get 请求,则显示当前的用户信息
        form.username.data = current_user.username
        form.about_me.data = current_user.about_me
    return render_template('edit_profile.html', title='编辑用户信息', form=form)
Beispiel #30
0
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.add(current_user._get_current_object())
        db.session.commit()
        flash(_('Your changes have been saved.'))
        return redirect(url_for('main.user', username=current_user.username))
    form.username.data = current_user.username
    form.about_me.data = current_user.about_me
    return render_template('edit_profile.html',
                           title=_('Edit Profile'),
                           form=form)