diff --git a/district/models.py b/district/models.py index c111fcf613aded6689892009c1ecf2affb898dbd..09d18f35b337ba67ee3c004ef9bd32f5fe499a4e 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 6f1899b9e1bfb71d22e3cf4208da62de9fc99d65..4a1f4ebaf42198fbb177f66d0c316f852266403a 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">