Example #1
0
File: views.py Project: Fy-/FyPress
def comments():
    count_published = SimpleComment.count_filter(SimpleComment.status == 'valid')
    count_spam = SimpleComment.count_filter(SimpleComment.status == 'spam')
    paginator = Paginator(
        query=SimpleComment.filter(SimpleComment.status == (request.args.get('filter') or 'valid')).order_by(SimpleComment.created),
        page=request.args.get('page')
    )
    akismet = Option.get(Option.name == 'akismet')

    if akismet:
        form = AkismetForm(api_key=akismet.value)
    else:
        form = AkismetForm()

    if form.validate_on_submit():
        Option.update('akismet', request.form['api_key'])
        fypress.options = Option.auto_load()
        return redirect(url_for('admin.comments'))

    return render_template('admin/comments.html',
                           count_published=count_published,
                           filter=request.args.get('filter'),
                           count_spam=count_spam,
                           pages=paginator.links,
                           akismet=akismet,
                           form=form,
                           comments=paginator.items,
                           title=gettext('Comments')
                           )
Example #2
0
def comments():
    count_published = SimpleComment.count_filter(
        SimpleComment.status == 'valid')
    count_spam = SimpleComment.count_filter(SimpleComment.status == 'spam')
    paginator = Paginator(query=SimpleComment.filter(SimpleComment.status == (
        request.args.get('filter') or 'valid')).order_by(
            SimpleComment.created),
                          page=request.args.get('page'))
    akismet = Option.get(Option.name == 'akismet')

    if akismet:
        form = AkismetForm(api_key=akismet.value)
    else:
        form = AkismetForm()

    if form.validate_on_submit():
        Option.update('akismet', request.form['api_key'])
        fypress.options = Option.auto_load()
        return redirect(url_for('admin.comments'))

    return render_template('admin/comments.html',
                           count_published=count_published,
                           filter=request.args.get('filter'),
                           count_spam=count_spam,
                           pages=paginator.links,
                           akismet=akismet,
                           form=form,
                           comments=paginator.items,
                           title=gettext('Comments'))
Example #3
0
def settings_design():
    options = Option.get_settings('design')
    if request.form:
        for data in request.form:
            Option.update(data, request.form[data])
        from fypress.public.views import reset_options
        reset_options()

        return redirect(url_for('admin.settings_design'))

    return render_template('admin/settings_design.html', design=options, title=gettext('Design - Settings'))
Example #4
0
def settings_social():
    form = SocialSettingsForm(obj=Option.get_settings('social'))

    if form.validate_on_submit():
        for data in form.data:
            Option.update(data, form.data[data])
        from fypress.public.views import reset_options
        reset_options()
        return redirect(url_for('admin.settings_social'))

    return render_template('admin/settings_social.html', form=form, title=gettext('Social - Settings'))
Example #5
0
File: views.py Project: Fy-/FyPress
def settings_design():
    options = Option.get_settings('design')

    if request.form:
        for data in request.form:
            Option.update(data, request.form[data])

        fypress.options = Option.auto_load()
        return redirect(url_for('admin.settings_design'))

    return render_template('admin/settings_design.html', design=options, title=gettext('Design - Settings'))
Example #6
0
File: views.py Project: Fy-/FyPress
def settings_general():
    form = GeneralSettingsForm(obj=Option.get_settings())

    if form.validate_on_submit():
        for data in form.data:
            Option.update(data, form.data[data])

        fypress.options = Option.auto_load()
        return redirect(url_for('admin.settings_general'))

    return render_template('admin/settings_general.html', form=form, title=gettext('General - Settings'))
Example #7
0
def settings_design():
    options = Option.get_settings('design')

    if request.form:
        for data in request.form:
            Option.update(data, request.form[data])

        fypress.options = Option.auto_load()
        return redirect(url_for('admin.settings_design'))

    return render_template('admin/settings_design.html',
                           design=options,
                           title=gettext('Design - Settings'))
Example #8
0
def settings_general():
    form = GeneralSettingsForm(obj=Option.get_settings())

    if form.validate_on_submit():
        for data in form.data:
            Option.update(data, form.data[data])

        fypress.options = Option.auto_load()
        return redirect(url_for('admin.settings_general'))

    return render_template('admin/settings_general.html',
                           form=form,
                           title=gettext('General - Settings'))
Example #9
0
def before_request():
    from fypress.user import User
    g.user = None
    if 'user_id' in session:
        g.user = User.query.get(session['user_id'])

    from fypress.admin import Option
    g.options = Option.auto_load()
Example #10
0
def before_request():
    g.user = None
    if 'user_id' in session:
        g.user = User.get(User.id == session['user_id'])

    fypress.options = Option.auto_load()
Example #11
0
def theme_active():
    Option.update('theme', request.args.get('theme'))
    fypress.options = Option.auto_load()
    return redirect(url_for('admin.themes'))
Example #12
0
File: views.py Project: Fy-/FyPress
def before_request():
    g.user = None
    if 'user_id' in session:
        g.user = User.get(User.id == session['user_id'])

    fypress.options = Option.auto_load()
Example #13
0
File: views.py Project: Fy-/FyPress
def theme_active():
    Option.update('theme', request.args.get('theme'))
    fypress.options = Option.auto_load()
    return redirect(url_for('admin.themes'))