Skip to content
Snippets Groups Projects
Commit db20b3a8 authored by OndraRehounek's avatar OndraRehounek
Browse files

main: fix codestyle etc.

parent 5bd792bc
No related branches found
No related tags found
2 merge requests!607Pirati.cz,!575Feature/pirati cz
Pipeline #9340 passed
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"),
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment