[fix] no posts?

main
yaemiku 2022-06-15 21:46:52 +02:00
parent 58187c18f6
commit b3cec78499
Signed by: podlaskizbs
GPG Key ID: ADC039636B3E4AAB
3 changed files with 11 additions and 2 deletions

View File

@ -1373,6 +1373,11 @@ select {
line-height: 2.25rem; line-height: 2.25rem;
} }
.text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
}
.font-bold { .font-bold {
font-weight: 700; font-weight: 700;
} }

View File

@ -1,10 +1,12 @@
{% extends 'base.html' %} {% block title %}Strona główna | pdlzbs{% endblock %} {% extends 'base.html' %} {% block title %}Strona główna | pdlzbs{% endblock %}
{% load static tailwind_tags %} {% block content %} {% load static tailwind_tags %} {% block content %}
<div class="flex flex-col lg:flex-row justify-around gap-4 prose-h1:font-light"> <div class="flex flex-col lg:flex-row justify-around gap-4 prose-h1:font-light">
{% if highlight %}
<article class="prose w-full basis-3/5"> <article class="prose w-full basis-3/5">
<h1>{{ highlight.title }}</h1> <h1>{{ highlight.title }}</h1>
{{ highlight.content | safe }} {{ highlight.content | safe }}
</article> </article>
{% endif %}
<div class="flex flex-col basis-2/5"> <div class="flex flex-col basis-2/5">
<h1 class="text-3xl pb-6 mb-4 border-b border-stone-500 border-dashed"> <h1 class="text-3xl pb-6 mb-4 border-b border-stone-500 border-dashed">
Aktualności PodlZBS Aktualności PodlZBS
@ -16,6 +18,8 @@
<h2 class="mb-0">{{ post.title }}</h2> <h2 class="mb-0">{{ post.title }}</h2>
{{ post.content | safe }} {{ post.content | safe }}
</article> </article>
{% empty %}
<span class="py-4 text-xl">Więcej wpisów nie ma</span>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

View File

@ -14,7 +14,7 @@ class HomeView(TemplateView):
posts = list(Post.objects.all()) posts = list(Post.objects.all())
context['home'] = 'active' context['home'] = 'active'
context['highlight'] = posts[0] context['highlight'] = posts[0] if len(posts) != 0 else None
context['posts'] = posts[1:] context['posts'] = posts[1:] if len(posts) > 1 else []
return context return context