From 5433d205450099dca6d27bd26df2a3d9d97df745 Mon Sep 17 00:00:00 2001 From: Rick Date: Thu, 28 Jan 2021 22:17:05 +0100 Subject: [PATCH] Ajout de category et article + nouveau css --- templates/article.html | 22 ++++++++++++++++++++++ templates/category.html | 11 +++++++++++ templates/macros.html | 20 ++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 templates/article.html create mode 100644 templates/category.html create mode 100644 templates/macros.html diff --git a/templates/article.html b/templates/article.html new file mode 100644 index 0000000..853368e --- /dev/null +++ b/templates/article.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} +{% block content %} +
+
+

Par + {% for author in article.authors %} + {{ author }} + {% endfor %} + dans {{ article.category }} le {{ article.date.strftime('%d/%m/%Y') }}. +

+
+

{{ article.title }}

+ {% if article.subtitle %} +

{{ article.subtitle }}

+ {% endif %} +
+
+ {{ article.content }} +
+
+ +{% endblock content %} diff --git a/templates/category.html b/templates/category.html new file mode 100644 index 0000000..2e1888b --- /dev/null +++ b/templates/category.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} +{% import "macros.html" as macro %} +{% block content %} +
+

{{ category.name }}

+
+
+ +{{ macro.listArticles(articles_page.object_list) }} + +{% endblock content %} diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..dfa5acf --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,20 @@ +{% macro listArticles(objIt) -%} +{% for art in objIt %} +
+

Par + {% for author in art.authors %} + {{ author }} + {% endfor %} + dans {{ art.category }} le {{ art.date.strftime('%d/%m/%Y') }}. +

+
+ +

{{ art.title }}

+
+
+ {{ art.summary }} +
+ Continuer à lire +
+{% endfor %} +{%- endmacro %}