Skip to content
Snippets Groups Projects
Commit 0ee5580c authored by jarmil's avatar jarmil
Browse files

Weby MS: preskupeni clanku pod stranku clanky; odkaz na autora

parent b1ff2ff6
No related branches found
No related tags found
2 merge requests!173Release,!134Weby pro MS
...@@ -106,7 +106,6 @@ class DistrictHomePage(MetadataPageMixin, Page): ...@@ -106,7 +106,6 @@ class DistrictHomePage(MetadataPageMixin, Page):
### RELATIONS ### RELATIONS
subpage_types = [ subpage_types = [
"shared.Article",
"shared.PeoplePage", "shared.PeoplePage",
"DistrictArticles", "DistrictArticles",
"DistrictContact", "DistrictContact",
...@@ -153,6 +152,10 @@ class DistrictArticles(SharedSubpageMixin, MetadataPageMixin, Page): ...@@ -153,6 +152,10 @@ class DistrictArticles(SharedSubpageMixin, MetadataPageMixin, Page):
settings_panels = [] settings_panels = []
subpage_types = [
"shared.Article",
]
### OTHERS ### OTHERS
class Meta: class Meta:
...@@ -161,8 +164,7 @@ class DistrictArticles(SharedSubpageMixin, MetadataPageMixin, Page): ...@@ -161,8 +164,7 @@ class DistrictArticles(SharedSubpageMixin, MetadataPageMixin, Page):
def get_context(self, request): def get_context(self, request):
context = super().get_context(request) context = super().get_context(request)
context["articles"] = Paginator( context["articles"] = Paginator(
self.get_siblings(inclusive=False).type(Article).live().specific(), self.get_children().live().specific(), self.max_items or 5,
self.max_items or 5,
).get_page(request.GET.get("page")) ).get_page(request.GET.get("page"))
return context return context
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<span class="pr-2">{{ page.last_published_at|date:"SHORT_DATE_FORMAT" }}</span> <span class="pr-2">{{ page.last_published_at|date:"SHORT_DATE_FORMAT" }}</span>
<span class="pl-2" itemprop="author" itemtype="http://schema.org/Person" itemscope=""> <span class="pl-2" itemprop="author" itemtype="http://schema.org/Person" itemscope="">
<span itemprop="name"> <span itemprop="name">
<a href="#">{{ page.author }}</a> <a href="{{ page.author.url }}">{{ page.author }}</a>
</span> </span>
</span> </span>
</div> </div>
......
# Generated by Django 3.1.1 on 2020-10-14 13:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("shared", "0008_personpage_search_image"),
]
operations = [
migrations.RemoveField(model_name="article", name="author",),
]
# Generated by Django 3.1.1 on 2020-10-14 13:13
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("shared", "0009_remove_article_author"),
]
operations = [
migrations.AddField(
model_name="article",
name="author",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="shared.personpage",
verbose_name="Autor článku",
),
),
]
...@@ -45,8 +45,14 @@ class Article(SharedSubpageMixin, MetadataPageMixin, Page): ...@@ -45,8 +45,14 @@ class Article(SharedSubpageMixin, MetadataPageMixin, Page):
null=True, null=True,
verbose_name="obrázek", verbose_name="obrázek",
) )
author = models.TextField("autor článku", blank=True)
tags = ClusterTaggableManager(through=ArticleTag, blank=True) tags = ClusterTaggableManager(through=ArticleTag, blank=True)
author = models.ForeignKey(
"shared.PersonPage",
verbose_name="Autor článku",
on_delete=models.PROTECT,
null=True,
blank=True,
)
### PANELS ### PANELS
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<meta itemprop="datePublished" content="{{ article.last_published_at }}" /> <meta itemprop="datePublished" content="{{ article.last_published_at }}" />
</span> </span>
<span class="article-card-meta__item" itemprop="author" itemtype="http://schema.org/Person" itemscope=""> <span class="article-card-meta__item" itemprop="author" itemtype="http://schema.org/Person" itemscope="">
<span itemprop="name">{{ article.author }}</span> <span itemprop="name">{{ article.author.name }}</span>
</span> </span>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment