diff --git a/district/templates/shared/article.html b/district/templates/shared/article.html index 280672b974fa9411a20db11072b38ed324d91767..632a69ad95c5b60e3e51e936201c0a3fa2ee42d8 100644 --- a/district/templates/shared/article.html +++ b/district/templates/shared/article.html @@ -1,5 +1,5 @@ {% extends "district/base.html" %} -{% load static wagtailcore_tags wagtailimages_tags shared_filters %} +{% load static wagtailcore_tags wagtailimages_tags %} {% block content %} @@ -45,7 +45,7 @@ <div class="lg:w-2/3"> <div itemprop="description" class="w-full content-block"> <p><strong>{{ page.perex }}</strong></p> - {{ page.text|markdown }} + {{ page.text|richtext }} </div> </div> diff --git a/shared/migrations/0014_auto_20201104_1134.py b/shared/migrations/0014_auto_20201104_1134.py new file mode 100644 index 0000000000000000000000000000000000000000..2566564697cb39bf43f372d06860a4e2342754c4 --- /dev/null +++ b/shared/migrations/0014_auto_20201104_1134.py @@ -0,0 +1,21 @@ +# Generated by Django 3.1.1 on 2020-11-04 10:34 + +from django.db import migrations +import wagtail.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("shared", "0013_auto_20201104_1053"), + ] + + operations = [ + migrations.AlterField( + model_name="article", + name="text", + field=wagtail.core.fields.RichTextField( + blank=True, verbose_name="text článku" + ), + ), + ] diff --git a/shared/models.py b/shared/models.py index 7ec838f036968bc05d29715aa7f9eaadfa882c53..66ba50126356bee0756526151276ea8723656f24 100644 --- a/shared/models.py +++ b/shared/models.py @@ -4,6 +4,7 @@ import random import requests import requests_cache from django.core.validators import MaxValueValidator, MinValueValidator +from wagtail.core.fields import RichTextField from django.db import models from modelcluster.contrib.taggit import ClusterTaggableManager from modelcluster.fields import ParentalKey @@ -39,7 +40,22 @@ class ArticleMixin(models.Model): """ Spolecna pole vsech clanku """ perex = models.CharField("perex", max_length=250, blank=True) - text = models.TextField("text článku", blank=True) + text = RichTextField( + "text článku", + blank=True, + features=[ + "h1", + "h2", + "h3", + "h4", + "bold", + "italic", + "ol", + "ul", + "link", + "document-link", + ], + ) date = models.DateField("datum článku", blank=False, default=datetime.datetime.now) tags = ClusterTaggableManager(through=ArticleTag, blank=True) @@ -70,9 +86,6 @@ class Article(ArticleMixin, Page, SharedSubpageMixin, MetadataPageMixin): FieldPanel("perex"), FieldPanel("date"), FieldPanel("text"), - HelpPanel( - """Text článku lze formátovat s použitím <a href="https://www.markdownguide.org/basic-syntax/">markdown</a>""" - ), FieldPanel("author"), ImageChooserPanel("image"), FieldPanel("tags"),