diff options
Diffstat (limited to 'home/models.py')
-rw-r--r-- | home/models.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/home/models.py b/home/models.py index 64acee0..7eabfba 100644 --- a/home/models.py +++ b/home/models.py @@ -1,9 +1,9 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ +from wagtail.admin.edit_handlers import FieldPanel from wagtail.core.models import Page from wagtail.core.fields import RichTextField -from wagtail.admin.edit_handlers import FieldPanel from wagtail.images.edit_handlers import ImageChooserPanel @@ -24,7 +24,27 @@ class BasePage(Page): class Meta: abstract = True + def get_context(self, request): + context = super().get_context(request) + context['menu_items'] = self.get_children().filter( + show_in_menus=True).live().order_by('pk') + return context + class HomePage(BasePage): - pass + organization = models.CharField(max_length=200, blank=True, null=True) + logo = models.ForeignKey( + 'wagtailimages.Image', on_delete=models.SET_NULL, related_name='+', + blank=True, null=True + ) + jumbotron = RichTextField(blank=True) + footer = RichTextField(blank=True) + content_panels = \ + [BasePage.content_panels[0]] + [ + FieldPanel('organization'), + ImageChooserPanel('logo'), + FieldPanel('jumbotron'), + ] + BasePage.content_panels[1:] + [ + FieldPanel('footer'), + ] |