diff --git a/publichealth/home/migrations/0010_auto_20170410_2307.py b/publichealth/home/migrations/0010_auto_20170410_2307.py new file mode 100644 index 0000000..f980985 --- /dev/null +++ b/publichealth/home/migrations/0010_auto_20170410_2307.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2017-04-10 21:07 +from __future__ import unicode_literals + +from django.db import migrations, models +import wagtail.wagtailcore.blocks +import wagtail.wagtailcore.fields +import wagtail.wagtailimages.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0009_contact_contactform_contactformfield'), + ] + + operations = [ + migrations.AddField( + model_name='articlepage', + name='on_homepage', + field=models.BooleanField(default=False, verbose_name='Auf der Frontpage anzeigen'), + ), + migrations.AlterField( + model_name='contactform', + name='intro_de', + field=wagtail.wagtailcore.fields.RichTextField(blank=True, default=''), + ), + migrations.AlterField( + model_name='contactform', + name='intro_fr', + field=wagtail.wagtailcore.fields.RichTextField(blank=True, default=''), + ), + migrations.AlterField( + model_name='contactform', + name='thanks_de', + field=wagtail.wagtailcore.fields.RichTextField(blank=True, default=''), + ), + migrations.AlterField( + model_name='contactform', + name='thanks_fr', + field=wagtail.wagtailcore.fields.RichTextField(blank=True, default=''), + ), + migrations.AlterField( + model_name='contactform', + name='title_fr', + field=models.CharField(default='', max_length=255), + ), + migrations.AlterField( + model_name='homepage', + name='infos_de', + field=wagtail.wagtailcore.fields.StreamField((('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock()), ('url', wagtail.wagtailcore.blocks.URLBlock())))),), blank=True, null=True), + ), + migrations.AlterField( + model_name='homepage', + name='infos_fr', + field=wagtail.wagtailcore.fields.StreamField((('info', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('photo', wagtail.wagtailimages.blocks.ImageChooserBlock()), ('summary', wagtail.wagtailcore.blocks.RichTextBlock(required=True)), ('action', wagtail.wagtailcore.blocks.CharBlock()), ('url', wagtail.wagtailcore.blocks.URLBlock())))),), blank=True, null=True), + ), + ] diff --git a/publichealth/home/models/models.py b/publichealth/home/models/models.py index 350e8e3..17a4e79 100644 --- a/publichealth/home/models/models.py +++ b/publichealth/home/models/models.py @@ -77,6 +77,9 @@ class ArticlePage(Page): ) date = models.DateField("Date", null=True, blank=True) + + on_homepage = models.BooleanField(default=False, verbose_name="Auf der Frontpage anzeigen") + feed_image = models.ForeignKey( 'wagtailimages.Image', null=True, @@ -108,6 +111,7 @@ class ArticlePage(Page): ] promote_panels = [ FieldPanel('date'), + FieldPanel('on_homepage'), InlinePanel('related_links', label="Links"), MultiFieldPanel(Page.promote_panels, "Common page configuration"), ] @@ -175,6 +179,7 @@ class HomePage(Page): def featured(self): # Get list of live pages that are descendants of this page articles = ArticlePage.objects.live() #.descendant_of(self) + articles = articles.filter(on_homepage=True) # Order by most recent date first #articles = articles.order_by('-date') return articles[:4]