diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2012-11-08 01:34:02 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2012-11-08 01:34:02 +0100 |
| commit | 101f820153cdb047d13166672d3f46cfef31677d (patch) | |
| tree | cf1806735201f39a1b6b88d179ed16ce1b97ea4f /templates/news | |
| parent | 9ab593bcd52fcbe87f1be463ca5f09a757d1128f (diff) | |
| download | famille-flask-101f820153cdb047d13166672d3f46cfef31677d.tar.gz | |
Keep both rst and html rendered content in the database. News edit feature
Diffstat (limited to 'templates/news')
| -rw-r--r-- | templates/news/add.html | 8 | ||||
| -rw-r--r-- | templates/news/list.html | 2 | ||||
| -rw-r--r-- | templates/news/show.html | 4 |
3 files changed, 9 insertions, 5 deletions
diff --git a/templates/news/add.html b/templates/news/add.html index c2bc018..53fb682 100644 --- a/templates/news/add.html +++ b/templates/news/add.html @@ -1,9 +1,13 @@ {% extends 'layout.html' %} {% block content %} +{% if news %} +<form action="{{ url_for('edit_news', news_id=news.id)}}" method="post"> +{% else %} <form action="{{ url_for('add_news')}}" method="post"> - <input type=text size=80 name=title /><br/> - <textarea name=content rows=20 cols=80></textarea> +{% endif %} + <input type=text size=80 name=title value="{% if news %}{{news.title}}{% endif %}"/><br/> + <textarea name=content rows=20 cols=80>{% if news %}{{news.content}}{% endif %}</textarea> <input type="submit" value="Submit" /> </form> {% endblock %} diff --git a/templates/news/list.html b/templates/news/list.html index ddbe1ab..a5a367a 100644 --- a/templates/news/list.html +++ b/templates/news/list.html @@ -11,7 +11,7 @@ </div> <div class="news_content"> - {{ news.content|safe }} + {{ news.content_cache|safe }} </div> {% endfor %} </div> diff --git a/templates/news/show.html b/templates/news/show.html index 411cdfc..7e03b5d 100644 --- a/templates/news/show.html +++ b/templates/news/show.html @@ -13,7 +13,7 @@ <h1>{{news.title}}</h1> <div class="news_content"> -{{news.content|safe}} +{{news.content_cache|safe}} </div> <hr/> @@ -23,7 +23,7 @@ Posté par <a href="">{{comment.name}}</a> le {{comment.date|format_date}} </h3> <div class="comment_content"/> -{{comment.content|safe}} +{{comment.content_cache|safe}} </div> {% endfor %} |
