Exemple #1
0
def settings():
    form = GeneralSettingsForm()

    form.theme.choices = [(theme.identifier, theme.name)
                          for theme in get_themes_list()]

    if form.validate_on_submit():
        current_user.theme = form.theme.data
        current_user.save()

        flash("Your settings have been updated!", "success")
    else:
        form.theme.data = current_user.theme

    return render_template("user/general_settings.html", form=form)
Exemple #2
0
def settings():
    form = GeneralSettingsForm()

    form.theme.choices = [(theme.identifier, theme.name)
                          for theme in get_themes_list()]

    if form.validate_on_submit():
        current_user.theme = form.theme.data
        current_user.save()

        flash("Your settings have been updated!", "success")
    else:
        form.theme.data = current_user.theme

    return render_template("user/general_settings.html", form=form)
Exemple #3
0
def settings():
    form = GeneralSettingsForm()

    form.theme.choices = get_available_themes()
    form.language.choices = get_available_languages()

    if form.validate_on_submit():
        current_user.theme = form.theme.data
        current_user.language = form.language.data
        current_user.save()

        flash(_("Settings updated."), "success")
    else:
        form.theme.data = current_user.theme
        form.language.data = current_user.language

    return render_template("user/general_settings.html", form=form)
Exemple #4
0
def settings():
    form = GeneralSettingsForm()

    form.theme.choices = [(theme.identifier, theme.name)
                          for theme in get_themes_list()]

    form.language.choices = [(locale.language, locale.display_name)
                             for locale in babel.list_translations()]

    if form.validate_on_submit():
        current_user.theme = form.theme.data
        current_user.language = form.language.data
        current_user.save()

        flash(_("Settings updated."), "success")
    else:
        form.theme.data = current_user.theme
        form.theme.data = current_user.language

    return render_template("user/general_settings.html", form=form)
Exemple #5
0
def settings():
    form = GeneralSettingsForm()

    form.theme.choices = [(theme.identifier, theme.name)
                          for theme in get_themes_list()]

    form.language.choices = [(locale.language, locale.display_name)
                             for locale in babel.list_translations()]

    if form.validate_on_submit():
        current_user.theme = form.theme.data
        current_user.language = form.language.data
        current_user.save()

        flash(_("Settings updated."), "success")
    else:
        form.theme.data = current_user.theme
        form.language.data = current_user.language

    return render_template("user/general_settings.html", form=form)
 def produce_form(self, data):
     form = GeneralSettingsForm(formdata=MultiDict(data),
                                meta={"csrf": False})
     form.language.choices = [
         ("python", "python"),
         ("ecmascript", "ecmascript"),
     ]
     form.theme.choices = [
         ("molokai", "molokai"),
         ("solarized", "solarized"),
     ]
     return form