Skip to content
Snippets Groups Projects
Commit 7cd82004 authored by jarmil's avatar jarmil Committed by jan.bednarik
Browse files

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

parent 496d67c8
No related branches found
No related tags found
2 merge requests!173Release,!134Weby pro MS
......@@ -106,7 +106,6 @@ class DistrictHomePage(MetadataPageMixin, Page):
### RELATIONS
subpage_types = [
"shared.Article",
"shared.PeoplePage",
"DistrictArticles",
"DistrictContact",
......@@ -153,6 +152,10 @@ class DistrictArticles(SharedSubpageMixin, MetadataPageMixin, Page):
settings_panels = []
subpage_types = [
"shared.Article",
]
### OTHERS
class Meta:
......@@ -161,8 +164,7 @@ class DistrictArticles(SharedSubpageMixin, MetadataPageMixin, Page):
def get_context(self, request):
context = super().get_context(request)
context["articles"] = Paginator(
self.get_siblings(inclusive=False).type(Article).live().specific(),
self.max_items or 5,
self.get_children().live().specific(), self.max_items or 5,
).get_page(request.GET.get("page"))
return context
......
......@@ -20,7 +20,7 @@
<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 itemprop="name">
<a href="#">{{ page.author }}</a>
<a href="{{ page.author.url }}">{{ page.author }}</a>
</span>
</span>
</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):
null=True,
verbose_name="obrázek",
)
author = models.TextField("autor článku", 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
......
......@@ -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 }}</span>
<span itemprop="name">{{ article.author.name }}</span>
</span>
</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