From: Frédéric Péters Date: Sun, 29 Dec 2019 21:05:52 +0000 (+0100) Subject: include latest post on homepage X-Git-Tag: v2022~45 X-Git-Url: https://git.0d.be/?p=chloro.git;a=commitdiff_plain;h=0fc394d0d3287c234a88941327505e25710f36d7 include latest post on homepage --- diff --git a/chloro/phyll/static/css/style.scss b/chloro/phyll/static/css/style.scss index c784925..cc3b224 100644 --- a/chloro/phyll/static/css/style.scss +++ b/chloro/phyll/static/css/style.scss @@ -64,7 +64,7 @@ main { } .home { - a { + nav a { text-transform: uppercase; display: inline-block; text-decoration: none; @@ -76,7 +76,7 @@ main { span { font-size: 30%; } - margin-bottom: 2rem; + margin-bottom: 1rem; &.divers { width: 49%; } @@ -86,6 +86,20 @@ main { float: right; } } + .latest { + margin-top: 2em; + h2 { + margin: 0; + font-size: 400%; + font-weight: bold; + text-transform: uppercase; + } + .meta { + padding-top: 0.5rem; + padding-left: 0.5rem; + color: lighten($text-color, 40%); + } + } } .post { diff --git a/chloro/phyll/templates/phyll/home.html b/chloro/phyll/templates/phyll/home.html index 987a446..b39a3ec 100644 --- a/chloro/phyll/templates/phyll/home.html +++ b/chloro/phyll/templates/phyll/home.html @@ -3,10 +3,18 @@ {% block content-class %}home{% endblock %} {% block body %} -
+ + +
+

{{ latest.title }}

+
{{ latest.creation_timestamp|date:"j E Y, H:i"|lower }}
+
+{{ latest.text|safe }} +
{% endblock %} diff --git a/chloro/phyll/views.py b/chloro/phyll/views.py index 78d2fec..6f0f0f7 100644 --- a/chloro/phyll/views.py +++ b/chloro/phyll/views.py @@ -65,6 +65,11 @@ class NoteDeleteView(DeleteView): class HomeView(TemplateView): template_name = 'phyll/home.html' + def get_context_data(self, **kwargs): + context = super(HomeView, self).get_context_data(**kwargs) + context['latest'] = Note.objects.filter(published=True).latest('creation_timestamp') + return context + class ArchivesView(ListView): model = Note