From b3cec7849916699a6c77aff035a320ec67588e21 Mon Sep 17 00:00:00 2001 From: yaemiku Date: Wed, 15 Jun 2022 21:46:52 +0200 Subject: [PATCH] [fix] no posts? --- core/static/css/dist/styles.css | 5 +++++ core/templates/home.html | 4 ++++ core/views.py | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/static/css/dist/styles.css b/core/static/css/dist/styles.css index 02eba8e..20d3075 100644 --- a/core/static/css/dist/styles.css +++ b/core/static/css/dist/styles.css @@ -1373,6 +1373,11 @@ select { line-height: 2.25rem; } +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + .font-bold { font-weight: 700; } diff --git a/core/templates/home.html b/core/templates/home.html index 46c242e..2d9a519 100644 --- a/core/templates/home.html +++ b/core/templates/home.html @@ -1,10 +1,12 @@ {% extends 'base.html' %} {% block title %}Strona główna | pdlzbs{% endblock %} {% load static tailwind_tags %} {% block content %}
+ {% if highlight %}

{{ highlight.title }}

{{ highlight.content | safe }}
+ {% endif %}

Aktualności PodlZBS @@ -16,6 +18,8 @@

{{ post.title }}

{{ post.content | safe }} + {% empty %} + Więcej wpisów nie ma {% endfor %}
diff --git a/core/views.py b/core/views.py index a759247..818766b 100644 --- a/core/views.py +++ b/core/views.py @@ -14,7 +14,7 @@ class HomeView(TemplateView): posts = list(Post.objects.all()) context['home'] = 'active' - context['highlight'] = posts[0] - context['posts'] = posts[1:] + context['highlight'] = posts[0] if len(posts) != 0 else None + context['posts'] = posts[1:] if len(posts) > 1 else [] return context