diff --git a/main/models.py b/main/models.py index 10203ade5ae44ed229e4b7f25bde3eaa91bc6504..d8a60e90fa45f8f2103038a5685f5ccf8c6fe9a2 100644 --- a/main/models.py +++ b/main/models.py @@ -1,3 +1,4 @@ +from datetime import timedelta from functools import cached_property from django.conf import settings @@ -5,6 +6,7 @@ from django.core.paginator import Paginator from django.db import models from django.http import HttpResponseRedirect from django.shortcuts import render +from django.utils import timezone from modelcluster.contrib.taggit import ClusterTaggableManager from modelcluster.fields import ParentalKey from taggit.models import TaggedItemBase @@ -172,7 +174,7 @@ class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin, class MainWorkPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, Page): perex = models.TextField() - timeline = StreamField( + timeline = StreamField( # TODO delete [ ( "article_list", @@ -198,6 +200,14 @@ class MainWorkPage(ExtendedMetadataPageMixin, SubpageMixin, MetadataPageMixin, P class Meta: verbose_name = "Piráti pracují" + def get_context(self, request, *args, **kwargs): + ctx = super().get_context(request, args, kwargs) + last_month = timezone.now().today().replace(day=1) - timedelta(days=1) + first_day_of_last_month = last_month.replace(day=1) + article_qs = MainArticlePage.objects.filter(date__gt=first_day_of_last_month) + # article_data_list = + return ctx + class MainArticleTag(TaggedItemBase): content_object = ParentalKey("main.MainArticlePage", on_delete=models.CASCADE) @@ -229,6 +239,7 @@ class MainArticlePage( content_panels = ArticleMixin.content_panels + [ FieldPanel("author_page"), + FieldPanel("region"), FieldPanel("tags"), ] diff --git a/main/templates/main/includes/layout/header.html b/main/templates/main/includes/layout/header.html index a1530bd3692f892278476f427d275b41cd33ddfc..c65b21ab3e78ab0715e0691b6eb164cc566c7976 100644 --- a/main/templates/main/includes/layout/header.html +++ b/main/templates/main/includes/layout/header.html @@ -1,32 +1,32 @@ {% load static %} <!-- Navbar --> <nav class="text-white bg-black transition duration-200"> - <!-- Flex container --> - <div class="flex items-center justify-between"> - <!-- Logo --> - <div class="logo flex bg-white px-12 w-80 h-16 my-8"> - <img src="{% static "shared/img/logo-full-black.svg" %}" alt="Pirátská strana" class="w-36" /> - </div> - <!-- Menu --> - <div class="flex space-x-6 uppercase gap-8"> - <a href="#">Jak pracujeme</a> - <a href="#">Program</a> - <a href="#">O nás</a> - <a href="#">Naloď se</a> - <a href="#">Přispěj</a> - <a href="#">Kontakty</a> - </div> - <!-- Social & Related --> - <div> - <a href="">FB</a> - <a href="">TWITTER</a> - <a href="">INSTAGRAM</a> - <a href="#" class="px-12 py-3 bg-lightGreen mr-2"> - Dary - </a> - <a href="#" class="px-12 py-3 text-blue-100 bg-purple mr-2"> - Nalodění - </a> - </div> + <!-- Flex container --> + <div class="flex items-center justify-between"> + <!-- Logo --> + <div class="logo flex bg-white px-12 w-80 h-16 my-8"> + <img src="{% static "shared/img/logo-full-black.svg" %}" alt="Pirátská strana" class="w-36"/> </div> + <!-- Menu --> + <div class="flex space-x-6 uppercase gap-8"> + <a href="#">Jak pracujeme</a> + <a href="#">Program</a> + <a href="#">O nás</a> + <a href="#">Naloď se</a> + <a href="#">Přispěj</a> + <a href="#">Kontakty</a> + </div> + <!-- Social & Related --> + <div> + <a href="">FB</a> + <a href="">TWITTER</a> + <a href="">INSTAGRAM</a> + <a href="#" class="px-12 py-3 bg-lightGreen mr-2"> + Dary + </a> + <a href="#" class="px-12 py-3 text-blue-100 bg-purple mr-2"> + Nalodění + </a> + </div> + </div> </nav>