diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2012-11-07 01:27:36 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2012-11-07 01:27:36 +0100 |
| commit | df25a48abd69292af55f3356a48a737da829cd20 (patch) | |
| tree | fdb3ba7d659ee5dd379eb41b284bac6832a2d729 /templates/news | |
| parent | e143cf83baf0c50da27251cee4f5e3a8929586a6 (diff) | |
| download | famille-flask-df25a48abd69292af55f3356a48a737da829cd20.tar.gz | |
Add basic news feature: list, show, add
Diffstat (limited to 'templates/news')
| -rw-r--r-- | templates/news/add.html | 9 | ||||
| -rw-r--r-- | templates/news/list.html | 19 | ||||
| -rw-r--r-- | templates/news/news_list.html | 23 | ||||
| -rw-r--r-- | templates/news/post.html | 8 | ||||
| -rw-r--r-- | templates/news/show.html (renamed from templates/news/news_detail.html) | 14 |
5 files changed, 34 insertions, 39 deletions
diff --git a/templates/news/add.html b/templates/news/add.html new file mode 100644 index 0000000..c2bc018 --- /dev/null +++ b/templates/news/add.html @@ -0,0 +1,9 @@ +{% extends 'layout.html' %} + +{% block content %} +<form action="{{ url_for('add_news')}}" method="post"> + <input type=text size=80 name=title /><br/> + <textarea name=content rows=20 cols=80></textarea> +<input type="submit" value="Submit" /> +</form> +{% endblock %} diff --git a/templates/news/list.html b/templates/news/list.html new file mode 100644 index 0000000..6ddf85a --- /dev/null +++ b/templates/news/list.html @@ -0,0 +1,19 @@ +{% extends 'layout.html' %} + +{% block content %} +<div class="news"> + {% for news in news %} + <div class="news_head"> + <h2><a href="{{ url_for('show_news', news_id = news.id)}}"> + {{ news.title }}</a> + </h2> + <p>Posté par <a href="">{{ news.name }}</a> le {{ news.date }}</p> + </div> + + <div class="news_content"> + {{ news.content }} + </div> + {% endfor %} +</div> +<div style="clear:both"/> +{% endblock %} diff --git a/templates/news/news_list.html b/templates/news/news_list.html deleted file mode 100644 index 2119a68..0000000 --- a/templates/news/news_list.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends 'base.html' %} - -{% block content %} -<div class="news"> - {% for news in news_list %} - <div class="news_head"> - <h2><a href="{% url news-details pk=news.id %}">{{ news.title }}</a></h2> - <!--div style="float:right"><a href="/home/edit/id/<?=$news['ident']?>">Modifier cette actualité</a></div--> - <p>Posté par <a href="/user/view/name/<?=$news['name']?>">{{ news.author.username }}</a> le {{ news.date }}</p> - </div> - - <p class="comments">{% with news.comment__count as comment_count %} - <a href="{% url news-details pk=news.id %}#comment">{{ comment_count }} commentaire{{comment_count|pluralize}}</a> | - <a href="{% url news-details pk=news.id %}#add">Ajouter un commentaire</a> - </p>{% endwith %} - - <div class="news_content"> - {{ news.text }} - </div> - {% endfor %} -</div> -<div style="clear:both"/> -{% endblock %} diff --git a/templates/news/post.html b/templates/news/post.html deleted file mode 100644 index 56ad2e4..0000000 --- a/templates/news/post.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends 'base.html' %} - -{% block content %} -<form action="{% url news.views.post %}" method="post"> -{{ form.as_p }} -<input type="submit" value="Submit" /> -</form> -{% endblock %} diff --git a/templates/news/news_detail.html b/templates/news/show.html index f65b91e..da188fe 100644 --- a/templates/news/news_detail.html +++ b/templates/news/show.html @@ -1,24 +1,23 @@ -{% extends 'base.html' %} +{% extends 'layout.html' %} {% block content %} -{% with news.comment_set.all as comments %} <div class="quickview"/> <h2>Détails</h2> <ul> - <li>Auteur : <a href="/user/view/name/<?=$this->news['name']?>">{{news.author}}</a></li> + <li>Auteur : <a href="">{{news.name}}</a></li> <li>Date : {{news.date}} </li> -<li><a href="#comments">{{coments}}</a></li> +<!--<li><a href="#comments">{{coments}}</a></li>--> </div> <div class="news"/> <h1>{{news.title}}</h1> <div class="news_content"> -{{news.text}} +{{news.content}} </div> <hr/> - +<!-- <h2 id="comments">Commentaires</h2> {% for comment in comments %} <h3 class="comment">Posté par <a href="/user/view/name/<?=$comment['name']?>">{{comment.author}}</a> le {{comment.date}} </h3> @@ -34,8 +33,7 @@ </textarea> <p class="submit"><input type="submit" value="Ajouter"/></p> +--> </div> - <div style="clear:both"/> -{% endwith %} {% endblock %} |
