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') )