From d63eb84929183578f7ae37dc3b481d044b78aa12 Mon Sep 17 00:00:00 2001 From: OndraRehounek <ondra.rehounek@seznam.cz> Date: Thu, 18 Nov 2021 11:08:02 +0100 Subject: [PATCH] district: Author page link --- district/models.py | 2 +- district/templates/district/district_article_page.html | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/district/models.py b/district/models.py index c111fcf6..09d18f35 100644 --- a/district/models.py +++ b/district/models.py @@ -211,7 +211,7 @@ class DistrictArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page): ### FIELDS author_page = models.ForeignKey( - "district.DistrictPersonPage", on_delete=models.SET_NULL, null=True + "district.DistrictPersonPage", on_delete=models.SET_NULL, null=True, blank=True ) is_black = models.BooleanField("Má tmavé pozadí?", default=False) tags = ClusterTaggableManager(through=DistrictArticleTag, blank=True) diff --git a/district/templates/district/district_article_page.html b/district/templates/district/district_article_page.html index 6f1899b9..4a1f4eba 100644 --- a/district/templates/district/district_article_page.html +++ b/district/templates/district/district_article_page.html @@ -16,7 +16,11 @@ <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">{{ page.author }}</span> + {% if page.author_page %} + <a href="{{ page.author_page.url }}" itemprop="name">{{ page.author }}</a> + {% else %} + <span itemprop="name">{{ page.author }}</span> + {% endif %} </span> </div> <div class="my-4"> -- GitLab