Mercurial > piecrust2
diff foodtruck/views/sources.py @ 593:2713b54b5d76
admin: Add summary of page in source listing.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 19 Jan 2016 21:33:31 -0800 |
parents | d4a01a023998 |
children | efc1dc916e7c |
line wrap: on
line diff
--- a/foodtruck/views/sources.py Sun Jan 17 23:09:32 2016 -0800 +++ b/foodtruck/views/sources.py Tue Jan 19 21:33:31 2016 -0800 @@ -1,6 +1,7 @@ from flask import g, abort, render_template, url_for from flask.ext.login import login_required from piecrust.data.paginator import Paginator +from ..textutil import text_preview, html_to_text from ..views import with_menu_context from ..web import app @@ -23,7 +24,8 @@ 'title': p['title'], 'slug': p['slug'], 'source': source_name, - 'url': url_for('edit_page', slug=p['slug'])} + 'url': url_for('edit_page', slug=p['slug']), + 'text': text_preview(html_to_text(p['content']), length=300)} data['pages'].append(page_data) prev_page_url = None