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') )
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'))
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'))
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'))
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'))
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'))
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()
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()
def theme_active(): Option.update('theme', request.args.get('theme')) fypress.options = Option.auto_load() return redirect(url_for('admin.themes'))