From 57d40866439031d95f1aef327b0e8b9520ad3cc2 Mon Sep 17 00:00:00 2001 From: petr Date: Tue, 10 Nov 2020 21:52:51 +0100 Subject: [PATCH] update + page + --- blog/settings/base.py | 1 + requirements.txt | 1 + stranky/migrations/0001_initial.py | 2 +- stranky/models.py | 4 +++- .../{stanka_page.html => templates/stranky/stranka_page.html} | 4 ++-- 5 files changed, 8 insertions(+), 4 deletions(-) rename stranky/{stanka_page.html => templates/stranky/stranka_page.html} (84%) diff --git a/blog/settings/base.py b/blog/settings/base.py index c7e4305..a6825f6 100644 --- a/blog/settings/base.py +++ b/blog/settings/base.py @@ -29,6 +29,7 @@ INSTALLED_APPS = [ 'wagtail.contrib.forms', 'wagtail.contrib.redirects', + 'wagtail.contrib.modeladmin', 'wagtail.embeds', 'wagtail.sites', 'wagtail.users', diff --git a/requirements.txt b/requirements.txt index 699e23d..1561311 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Django>=3.1,<3.2 wagtail>=2.10,<2.12 + diff --git a/stranky/migrations/0001_initial.py b/stranky/migrations/0001_initial.py index 228b1f4..0781d39 100644 --- a/stranky/migrations/0001_initial.py +++ b/stranky/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.3 on 2020-11-06 10:27 +# Generated by Django 3.1.3 on 2020-11-10 20:29 from django.db import migrations, models import django.db.models.deletion diff --git a/stranky/models.py b/stranky/models.py index 2d5c0fe..c70364c 100644 --- a/stranky/models.py +++ b/stranky/models.py @@ -8,6 +8,7 @@ from wagtail.admin.edit_handlers import FieldPanel, InlinePanel from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.search import index + class StrankaPage(Page): body = RichTextField(blank=True) @@ -20,6 +21,7 @@ class StrankaPage(Page): InlinePanel('gallery_images', label="Obrázky"), ] + class StrankaPageGalleryImage(Orderable): page = ParentalKey(StrankaPage, on_delete=models.CASCADE, related_name='gallery_images') image = models.ForeignKey( @@ -30,4 +32,4 @@ class StrankaPageGalleryImage(Orderable): panels = [ ImageChooserPanel('image'), FieldPanel('caption'), - ] \ No newline at end of file + ] diff --git a/stranky/stanka_page.html b/stranky/templates/stranky/stranka_page.html similarity index 84% rename from stranky/stanka_page.html rename to stranky/templates/stranky/stranka_page.html index f87c078..76747f8 100644 --- a/stranky/stanka_page.html +++ b/stranky/templates/stranky/stranka_page.html @@ -2,10 +2,11 @@ {% load wagtailcore_tags wagtailimages_tags %} -{% block body_class %}template-blogpage{% endblock %} +{% block body_class %}template-strankapage{% endblock %} {% block content %}

{{ page.title }}

+ {{ page.body|richtext }} {% for item in page.gallery_images.all %} @@ -15,6 +16,5 @@ {% endfor %}
- {% endblock %} \ No newline at end of file