diff --git a/district/migrations/0002_auto_20210205_1514.py b/district/migrations/0002_auto_20210205_1514.py new file mode 100644 index 0000000000000000000000000000000000000000..0c9ccd229629c484cbf3826bf2e397fb237d6243 --- /dev/null +++ b/district/migrations/0002_auto_20210205_1514.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.3 on 2021-02-05 14:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("district", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="districtarticlepage", + name="perex", + field=models.TextField(verbose_name="perex"), + ), + ] diff --git a/district/models.py b/district/models.py index 25dcf9fe051889ea5f0152fe841976944c47c263..89852ad4ec382cf38a1e3ea7d4831b147f43dd93 100644 --- a/district/models.py +++ b/district/models.py @@ -176,9 +176,7 @@ class DistrictArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page): class DistrictArticlesPage(SubpageMixin, MetadataPageMixin, Page): ### FIELDS - max_items = models.IntegerField( - "Maximalni pocet prvku na strance", blank=True, null=True - ) + max_items = models.IntegerField("Počet článků na stránce", default=12) ### PANELS @@ -202,7 +200,7 @@ class DistrictArticlesPage(SubpageMixin, MetadataPageMixin, Page): context = super().get_context(request) context["articles"] = Paginator( self.get_children().live().specific(), - self.max_items or 5, + self.max_items, ).get_page(request.GET.get("page")) return context diff --git a/district/templates/district/base.html b/district/templates/district/base.html index 61a895a5dcaa75f9caa5355f747a131a269401e0..7b44648190c5ef35496ac30454d04526d1995522 100644 --- a/district/templates/district/base.html +++ b/district/templates/district/base.html @@ -24,8 +24,8 @@ } </style> - {% if page.matomo_id %} - {% include "shared/matomo_snippet.html" with matomo_id=page.matomo_id %} + {% if page.root_page.matomo_id %} + {% include "shared/matomo_snippet.html" with matomo_id=page.root_page.matomo_id %} {% endif %} </head> @@ -79,12 +79,12 @@ <div v-if="show || isLgScreenSize" class="navbar__main navbar__section navbar__section--expandable container-padding--zero lg:container-padding--auto"> <ul class="navbar-menu text-white"> - <li class="navbar-menu__item"><a href="{{ page.root_page.articles_page.url }}" class="navbar-menu__link">{{ page.root_page.articles_page }}</a></li> - <li class="navbar-menu__item"><a href="{{ page.root_page.people_page.url }}" class="navbar-menu__link">{{ page.root_page.people_page }}</a></li> + <li class="navbar-menu__item"><a href="{% pageurl page.root_page.articles_page %}" class="navbar-menu__link">{{ page.root_page.articles_page }}</a></li> + <li class="navbar-menu__item"><a href="{% pageurl page.root_page.people_page %}" class="navbar-menu__link">{{ page.root_page.people_page }}</a></li> {% comment %} <li class="navbar-menu__item"><a href="/komunalni-program/" class="navbar-menu__link">Komunální program</a></li> {% endcomment %} - <li class="navbar-menu__item"><a href="{{ page.root_page.contact_page.url }}" class="navbar-menu__link">{{ page.root_page.contact_page }}</a></li> + <li class="navbar-menu__item"><a href="{% pageurl page.root_page.contact_page %}" class="navbar-menu__link">{{ page.root_page.contact_page }}</a></li> </ul> </div> @@ -119,6 +119,8 @@ <nav class="subnav py-2"> <div class="container container--wide"> <div class="flex"> + + {% comment %} <button @click="toggleView('regions')" class="btn btn--condensed btn--grey-500 btn--hoveractive btn--to-white text-sm mr-2 px-0" :class="{'btn--activated': isCurrentView('regions')}"> <div class="btn__body py-2"> <span>Piráti v dalších krajích</span> @@ -132,6 +134,7 @@ <span class="hidden md:block">Krajský kalendář</span> </div> </button> + {% endcomment %} {% if page.root_page.facebook %} <a href="{{ page.root_page.facebook }}" target="_blank" rel="noopener noreferrer" class="btn btn--inline-icon btn--condensed btn--hoveractive btn--grey-500 btn--to-brands-facebook text-sm ml-2 px-0"> diff --git a/district/templates/shared/article.html b/district/templates/district/district_article_page.html similarity index 94% rename from district/templates/shared/article.html rename to district/templates/district/district_article_page.html index 632a69ad95c5b60e3e51e936201c0a3fa2ee42d8..3fb3e61de5f441deae372df8e1163fa80458e9ee 100644 --- a/district/templates/shared/article.html +++ b/district/templates/district/district_article_page.html @@ -19,9 +19,7 @@ <div class="inline-flex divide-x flex-grow"> <span class="pr-2">{{ page.date|date:"SHORT_DATE_FORMAT" }}</span> <span class="pl-2" itemprop="author" itemtype="http://schema.org/Person" itemscope=""> - <span itemprop="name"> - <a href="{{ page.author.url }}">{{ page.author.name }}</a> - </span> + <span itemprop="name">{{ page.author }}</span> </span> </div> @@ -44,7 +42,6 @@ <div class="lg:w-2/3"> <div itemprop="description" class="w-full content-block"> - <p><strong>{{ page.perex }}</strong></p> {{ page.text|richtext }} </div> </div> diff --git a/district/templates/district/district_articles.html b/district/templates/district/district_articles_page.html similarity index 100% rename from district/templates/district/district_articles.html rename to district/templates/district/district_articles_page.html diff --git a/district/templates/district/district_contact.html b/district/templates/district/district_contact_page.html similarity index 98% rename from district/templates/district/district_contact.html rename to district/templates/district/district_contact_page.html index b36d00c13345e268b7f81d6cdc08a56278cc7031..a5bd3d0be1550731ddd4a2b717e8b622a576b897 100644 --- a/district/templates/district/district_contact.html +++ b/district/templates/district/district_contact_page.html @@ -13,7 +13,7 @@ <h1 itemprop="headline" class="head-alt-md md:head-alt-lg max-w-5xl mb-8">{{ page.title }}</h1> </header> - {% for item in page.contact_persons %} + {% for item in page.contact_people %} <div> <h2 class="head-heavy-sm mb-2 lg:mb-4 mt-4">{{ item.value.name }}</h2> diff --git a/district/templates/shared/people_page.html b/district/templates/district/district_people_page.html similarity index 100% rename from district/templates/shared/people_page.html rename to district/templates/district/district_people_page.html diff --git a/district/templates/shared/person_page.html b/district/templates/district/district_person_page.html similarity index 100% rename from district/templates/shared/person_page.html rename to district/templates/district/district_person_page.html diff --git a/district/templates/district/district_tags.html b/district/templates/district/district_tags_page.html similarity index 100% rename from district/templates/district/district_tags.html rename to district/templates/district/district_tags_page.html diff --git a/shared/models.py b/shared/models.py index 4007fae3160122d028c98267ad5f221df2d83c9f..5eeeef30f2863535493957a7e406986b562e6b7a 100644 --- a/shared/models.py +++ b/shared/models.py @@ -22,7 +22,7 @@ class SubpageMixin: class ArticleMixin(models.Model): - """ Spolecna pole vsech clanku """ + """Common fields for articles""" RICH_TEXT_FEATURES = [ "h2", @@ -38,9 +38,10 @@ class ArticleMixin(models.Model): ### FIELDS - perex = models.CharField("perex", max_length=250, blank=True) - text = RichTextField("text článku", blank=True, features=RICH_TEXT_FEATURES) - date = models.DateField("datum článku", blank=False, default=timezone.now) + date = models.DateField("datum", default=timezone.now) + perex = models.TextField("perex") + text = RichTextField("článek", blank=True, features=RICH_TEXT_FEATURES) + author = models.CharField("autor", max_length=250, blank=True, null=True) image = models.ForeignKey( "wagtailimages.Image", on_delete=models.PROTECT, @@ -48,13 +49,12 @@ class ArticleMixin(models.Model): null=True, verbose_name="obrázek", ) - author = models.CharField("autor", max_length=250, blank=True, null=True) ### PANELS content_panels = Page.content_panels + [ - FieldPanel("perex"), FieldPanel("date"), + FieldPanel("perex"), FieldPanel("text"), FieldPanel("author"), ImageChooserPanel("image"), diff --git a/shared/templates/shared/article_preview.html b/shared/templates/shared/article_preview.html index d584cb2240fd7553a33318fa3dfee51b8e902621..5227cf33daeef4f6353dbbb5c2583e2f83673d2c 100644 --- a/shared/templates/shared/article_preview.html +++ b/shared/templates/shared/article_preview.html @@ -33,7 +33,7 @@ <meta itemprop="datePublished" content="{{ article.last_published_at }}" /> </span> <span class="article-card-meta__item" itemprop="author" itemtype="http://schema.org/Person" itemscope=""> - <span itemprop="name">{{ article.author.name }}</span> + <span itemprop="name">{{ article.author }}</span> </span> </div>