Пример #1
0
def settings():
    form = SettingForm()
    if form.validate_on_submit():
        current_user.name = form.name.data
        current_user.blog_title = form.blog_title.data
        current_user.blog_sub_title = form.blog_sub_title.data
        current_user.about = form.about.data
        db.session.commit()
        flash('设置已更新', 'success')
        return redirect(url_for('blog.index'))
    form.name.data = current_user.name
    form.blog_title.data = current_user.blog_title
    form.blog_sub_title.data = current_user.blog_sub_title
    form.about.data = current_user.about
    return render_template('admin/settings.html', form=form)
Пример #2
0
def settings():
    settingform = SettingForm()
    if settingform.validate_on_submit():
        setup["pDiff"] = settingform.diff.data
        setup["pName"] = settingform.name.data
        if settingform.diff.data == "easy":
            setup["pCredits"] = 1000
            setup["pSPLimit"] = 16
        if settingform.diff.data == "med":
            setup["pCredits"] = 800
            setup["pSPLimit"] = 14
        if settingform.diff.data == "hard":
            setup["pCredits"] = 500
            setup["pSPLimit"] = 12
        return redirect(url_for("skillpoints"))
    return render_template("settings.html", form=settingform)