diff --git a/db.sqlite3 b/db.sqlite3 index 5d9ce8d..d846109 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/home/models.py b/home/models.py index 6484420..27e804b 100644 --- a/home/models.py +++ b/home/models.py @@ -6,6 +6,8 @@ from wagtail.admin.edit_handlers import FieldPanel class HomePage(Page): body = RichTextField(blank=True) + subpage_types=["stranky.StrankyPage","tip.TipIndexPage"] + content_panels = Page.content_panels + [ FieldPanel('body', classname="full"), diff --git a/home/templates/home/home_page.html b/home/templates/home/home_page.html index 7a8c6d6..46f2c91 100644 --- a/home/templates/home/home_page.html +++ b/home/templates/home/home_page.html @@ -1,15 +1,45 @@ + + {% extends "base.html" %} {% load wagtailcore_tags %} +
+ -{% block body_class %}template-homepage{% endblock %} + {% block body_class %}template-homepage{% endblock %} -{% block extra_css %} + {% block extra_css %} -{% endblock extra_css %} + {% endblock extra_css %} -{% block content %} + {% block content %} - {{ page.body|richtext }} + {{ page.body|richtext }} -{% endblock content %} + {% endblock content %} +
diff --git a/tip/models.py b/tip/models.py index bfd75a3..73c9117 100644 --- a/tip/models.py +++ b/tip/models.py @@ -11,6 +11,7 @@ from wagtail.search import index class TipIndexPage(Page): intro = RichTextField(blank=True) + subpage_types=["tip.TipPage"] #stranka která bude po tipindex content_panels = Page.content_panels + [ FieldPanel('intro', classname="full") @@ -21,6 +22,9 @@ class TipPage(Page): date = models.DateField("Post date") intro = models.CharField(max_length=250) body = RichTextField(blank=True) + + subpage_types = [] # omezení stránek + parent_page_types = ["tip.TipIndexPage"] def main_image(self): gallery_item = self.gallery_images.first() diff --git a/tip/templates/tip/tip_index_page.html b/tip/templates/tip/tip_index_page.html index 3009422..8b44d0d 100644 --- a/tip/templates/tip/tip_index_page.html +++ b/tip/templates/tip/tip_index_page.html @@ -5,6 +5,8 @@ {% block body_class %}template-blogindexpage{% endblock %} {% block content %} +
+

{{ page.title }}

diff --git a/tipy/models.py b/tipy/models.py deleted file mode 100644 index 6aa704b..0000000 --- a/tipy/models.py +++ /dev/null @@ -1,30 +0,0 @@ -from django.db import models - -from modelcluster.fields import ParentalKey - -from wagtail.core.models import Page, Orderable -from wagtail.core.fields import RichTextField -from wagtail.admin.edit_handlers import FieldPanel, InlinePanel -from wagtail.images.edit_handlers import ImageChooserPanel -from wagtail.search import index - - -class TipyIndexPage(Page): - pass - - -class TipPage(Page): - popisek = models.CharField(max_length=250) - image = models.ForeignKey( - 'wagtailimages.Image', on_delete=models.PROTECT, related_name='+' - ) - - search_fields = Page.search_fields + [ - index.SearchField('popisek'), - ] - - content_panels = Page.content_panels + [ - FieldPanel('popisek'), - ImageChooserPanel('image'), - ] -