From c845ee770661c864ec4fb7e7f70ac45e33e031af Mon Sep 17 00:00:00 2001 From: Michael Harrison Date: Tue, 26 Jan 2021 09:49:38 -0600 Subject: [PATCH 1/5] remove old, old impact page --- pages/migrations/0018_auto_20210126_0947.py | 30 ++++++++++++ pages/models.py | 53 --------------------- 2 files changed, 30 insertions(+), 53 deletions(-) create mode 100644 pages/migrations/0018_auto_20210126_0947.py diff --git a/pages/migrations/0018_auto_20210126_0947.py b/pages/migrations/0018_auto_20210126_0947.py new file mode 100644 index 000000000..56a32642a --- /dev/null +++ b/pages/migrations/0018_auto_20210126_0947.py @@ -0,0 +1,30 @@ +# Generated by Django 3.0.4 on 2021-01-26 15:47 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0059_apply_collection_ordering'), + ('wagtailredirects', '0006_redirect_increase_max_length'), + ('wagtailforms', '0004_add_verbose_name_plural'), + ('pages', '0017_tutorlanding'), + ] + + operations = [ + migrations.RemoveField( + model_name='ourimpactinstitutions', + name='institutions_ptr', + ), + migrations.RemoveField( + model_name='ourimpactinstitutions', + name='page', + ), + migrations.DeleteModel( + name='OurImpact', + ), + migrations.DeleteModel( + name='OurImpactInstitutions', + ), + ] diff --git a/pages/models.py b/pages/models.py index 859e2c887..18c702077 100644 --- a/pages/models.py +++ b/pages/models.py @@ -264,7 +264,6 @@ class Meta: 'pages.TeamPage', 'pages.GeneralPage', 'pages.FoundationSupport', - 'pages.OurImpact', 'pages.MapPage', 'pages.Give', 'pages.TermsOfService', @@ -573,58 +572,6 @@ class FoundationSupport(Page): max_count = 1 -class OurImpactInstitutions(Orderable, Institutions): - page = ParentalKey('pages.OurImpact', related_name='institutions') - - -class OurImpact(Page): - intro_heading = models.CharField(max_length=255) - intro_description = models.TextField() - - row_1 = StreamField([ - ('column', ColumnBlock()), - ]) - promote_image = models.ForeignKey( - 'wagtailimages.Image', - null=True, - blank=True, - on_delete=models.SET_NULL, - related_name='+' - ) - - api_fields = [ - APIField('title'), - APIField('intro_heading'), - APIField('intro_description'), - APIField('row_1'), - APIField('institutions'), - APIField('slug'), - APIField('seo_title'), - APIField('search_description'), - APIField('promote_image') - ] - - content_panels = [ - FieldPanel('title', classname='full title'), - FieldPanel('intro_heading'), - FieldPanel('intro_description'), - StreamFieldPanel('row_1'), - InlinePanel('institutions', label="Institutions"), - ] - - promote_panels = [ - FieldPanel('slug'), - FieldPanel('seo_title'), - FieldPanel('search_description'), - ImageChooserPanel('promote_image') - ] - - template = 'page.html' - - parent_page_types = ['pages.HomePage'] - max_count = 1 - - class MapPage(Page): header_text = models.CharField(max_length=255) map_image = models.ForeignKey( From 64b9a31d8fa1b2847c23633bd8272c0f9bf5c3b3 Mon Sep 17 00:00:00 2001 From: Michael Harrison Date: Tue, 26 Jan 2021 16:15:14 -0600 Subject: [PATCH 2/5] Updated Impact page --- pages/custom_blocks.py | 9 + pages/migrations/0019_auto_20210126_1056.py | 41 +++++ pages/migrations/0020_auto_20210126_1314.py | 22 +++ pages/migrations/0021_auto_20210126_1318.py | 22 +++ pages/migrations/0022_auto_20210126_1323.py | 47 +++++ pages/migrations/0023_auto_20210126_1333.py | 22 +++ pages/migrations/0024_auto_20210126_1336.py | 47 +++++ pages/migrations/0025_auto_20210126_1519.py | 21 +++ pages/migrations/0026_auto_20210126_1521.py | 21 +++ pages/migrations/0027_auto_20210126_1607.py | 21 +++ pages/models.py | 194 ++++++++------------ 11 files changed, 346 insertions(+), 121 deletions(-) create mode 100644 pages/migrations/0019_auto_20210126_1056.py create mode 100644 pages/migrations/0020_auto_20210126_1314.py create mode 100644 pages/migrations/0021_auto_20210126_1318.py create mode 100644 pages/migrations/0022_auto_20210126_1323.py create mode 100644 pages/migrations/0023_auto_20210126_1333.py create mode 100644 pages/migrations/0024_auto_20210126_1336.py create mode 100644 pages/migrations/0025_auto_20210126_1519.py create mode 100644 pages/migrations/0026_auto_20210126_1521.py create mode 100644 pages/migrations/0027_auto_20210126_1607.py diff --git a/pages/custom_blocks.py b/pages/custom_blocks.py index bf8efcbf2..55ac90458 100644 --- a/pages/custom_blocks.py +++ b/pages/custom_blocks.py @@ -89,3 +89,12 @@ class CardImageBlock(blocks.StructBlock): class Meta: icon = 'image' + + +class StoryBlock(blocks.StreamBlock): + image = APIImageChooserBlock(required=False) + story_text = blocks.TextBlock(required=False) + embeded_video = blocks.RawHTMLBlock(required=False) + + class Meta: + icon = 'openquote' diff --git a/pages/migrations/0019_auto_20210126_1056.py b/pages/migrations/0019_auto_20210126_1056.py new file mode 100644 index 000000000..744c215e2 --- /dev/null +++ b/pages/migrations/0019_auto_20210126_1056.py @@ -0,0 +1,41 @@ +# Generated by Django 3.0.4 on 2021-01-26 16:56 + +from django.db import migrations, models +import django.db.models.deletion +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0059_apply_collection_ordering'), + ('wagtailforms', '0004_add_verbose_name_plural'), + ('wagtailredirects', '0006_redirect_increase_max_length'), + ('pages', '0018_auto_20210126_0947'), + ] + + operations = [ + migrations.CreateModel( + name='Impact', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')), + ('improving_access', wagtail.core.fields.StreamField([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('button_text', wagtail.core.blocks.CharBlock()), ('button_href', wagtail.core.blocks.URLBlock())], blank=True)), + ('reach', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('icon', pages.custom_blocks.APIImageChooserBlock(required=False)), ('title', wagtail.core.blocks.CharBlock(required=True)), ('description', wagtail.core.blocks.RichTextBlock(required=True))])))], blank=True)), + ('quote', wagtail.core.fields.StreamField([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock())], blank=True)), + ('making_a_difference', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('stories', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('story_text', wagtail.core.blocks.TextBlock(required=False)), ('embeded_video', wagtail.core.blocks.RawHTMLBlock(required=False))])))], blank=True)), + ('disruption', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('graph', wagtail.core.blocks.StructBlock([('top_caption', wagtail.core.blocks.CharBlock()), ('bottom_caption', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))], required=False)), ('image_alt_text', wagtail.core.blocks.CharBlock(required=False))]))], blank=True)), + ('supporter_community', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock()), ('link_text', wagtail.core.blocks.CharBlock()), ('link_href', wagtail.core.blocks.URLBlock())], blank=True)), + ('giving', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('link', wagtail.core.blocks.CharBlock()), ('link_text', wagtail.core.blocks.CharBlock())], blank=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.DeleteModel( + name='AnnualReportPage', + ), + ] diff --git a/pages/migrations/0020_auto_20210126_1314.py b/pages/migrations/0020_auto_20210126_1314.py new file mode 100644 index 000000000..272f4e4ea --- /dev/null +++ b/pages/migrations/0020_auto_20210126_1314.py @@ -0,0 +1,22 @@ +# Generated by Django 3.0.4 on 2021-01-26 19:14 + +from django.db import migrations +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0019_auto_20210126_1056'), + ] + + operations = [ + migrations.AlterField( + model_name='impact', + name='improving_access', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StreamBlock([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('button_text', wagtail.core.blocks.CharBlock()), ('button_href', wagtail.core.blocks.URLBlock())], max_num=1), blank=True))]), + ), + ] diff --git a/pages/migrations/0021_auto_20210126_1318.py b/pages/migrations/0021_auto_20210126_1318.py new file mode 100644 index 000000000..6c8a1496e --- /dev/null +++ b/pages/migrations/0021_auto_20210126_1318.py @@ -0,0 +1,22 @@ +# Generated by Django 3.0.4 on 2021-01-26 19:18 + +from django.db import migrations +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0020_auto_20210126_1314'), + ] + + operations = [ + migrations.AlterField( + model_name='impact', + name='improving_access', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('button_text', wagtail.core.blocks.CharBlock()), ('button_href', wagtail.core.blocks.URLBlock())], max_num=1))], blank=True), + ), + ] diff --git a/pages/migrations/0022_auto_20210126_1323.py b/pages/migrations/0022_auto_20210126_1323.py new file mode 100644 index 000000000..2aea2c77e --- /dev/null +++ b/pages/migrations/0022_auto_20210126_1323.py @@ -0,0 +1,47 @@ +# Generated by Django 3.0.4 on 2021-01-26 19:23 + +from django.db import migrations +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0021_auto_20210126_1318'), + ] + + operations = [ + migrations.AlterField( + model_name='impact', + name='disruption', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('graph', wagtail.core.blocks.StructBlock([('top_caption', wagtail.core.blocks.CharBlock()), ('bottom_caption', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))], required=False)), ('image_alt_text', wagtail.core.blocks.CharBlock(required=False))]))], max_num=1))], blank=True), + ), + migrations.AlterField( + model_name='impact', + name='giving', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('link', wagtail.core.blocks.CharBlock()), ('link_text', wagtail.core.blocks.CharBlock())], max_num=1))], blank=True), + ), + migrations.AlterField( + model_name='impact', + name='making_a_difference', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('stories', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('story_text', wagtail.core.blocks.TextBlock(required=False)), ('embeded_video', wagtail.core.blocks.RawHTMLBlock(required=False))])))], max_num=1))], blank=True), + ), + migrations.AlterField( + model_name='impact', + name='quote', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock())], max_num=1))], blank=True), + ), + migrations.AlterField( + model_name='impact', + name='reach', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('icon', pages.custom_blocks.APIImageChooserBlock(required=False)), ('title', wagtail.core.blocks.CharBlock(required=True)), ('description', wagtail.core.blocks.RichTextBlock(required=True))])))], max_num=1))], blank=True), + ), + migrations.AlterField( + model_name='impact', + name='supporter_community', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock()), ('link_text', wagtail.core.blocks.CharBlock()), ('link_href', wagtail.core.blocks.URLBlock())], max_num=1))], blank=True), + ), + ] diff --git a/pages/migrations/0023_auto_20210126_1333.py b/pages/migrations/0023_auto_20210126_1333.py new file mode 100644 index 000000000..4f1de6ee3 --- /dev/null +++ b/pages/migrations/0023_auto_20210126_1333.py @@ -0,0 +1,22 @@ +# Generated by Django 3.0.4 on 2021-01-26 19:33 + +from django.db import migrations +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0022_auto_20210126_1323'), + ] + + operations = [ + migrations.AlterField( + model_name='impact', + name='improving_access', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('button_text', wagtail.core.blocks.CharBlock()), ('button_href', wagtail.core.blocks.URLBlock())]))]), + ), + ] diff --git a/pages/migrations/0024_auto_20210126_1336.py b/pages/migrations/0024_auto_20210126_1336.py new file mode 100644 index 000000000..cea1a627a --- /dev/null +++ b/pages/migrations/0024_auto_20210126_1336.py @@ -0,0 +1,47 @@ +# Generated by Django 3.0.4 on 2021-01-26 19:36 + +from django.db import migrations +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0023_auto_20210126_1333'), + ] + + operations = [ + migrations.AlterField( + model_name='impact', + name='disruption', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('graph', wagtail.core.blocks.StructBlock([('top_caption', wagtail.core.blocks.CharBlock()), ('bottom_caption', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))], required=False)), ('image_alt_text', wagtail.core.blocks.CharBlock(required=False))]))]))]), + ), + migrations.AlterField( + model_name='impact', + name='giving', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('link', wagtail.core.blocks.CharBlock()), ('link_text', wagtail.core.blocks.CharBlock())]))]), + ), + migrations.AlterField( + model_name='impact', + name='making_a_difference', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('stories', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('story_text', wagtail.core.blocks.TextBlock(required=False)), ('embeded_video', wagtail.core.blocks.RawHTMLBlock(required=False))])))]))]), + ), + migrations.AlterField( + model_name='impact', + name='quote', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock())]))]), + ), + migrations.AlterField( + model_name='impact', + name='reach', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('icon', pages.custom_blocks.APIImageChooserBlock(required=False)), ('title', wagtail.core.blocks.CharBlock(required=True)), ('description', wagtail.core.blocks.RichTextBlock(required=True))])))]))]), + ), + migrations.AlterField( + model_name='impact', + name='supporter_community', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock()), ('link_text', wagtail.core.blocks.CharBlock()), ('link_href', wagtail.core.blocks.URLBlock())]))]), + ), + ] diff --git a/pages/migrations/0025_auto_20210126_1519.py b/pages/migrations/0025_auto_20210126_1519.py new file mode 100644 index 000000000..4f6c26a92 --- /dev/null +++ b/pages/migrations/0025_auto_20210126_1519.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.4 on 2021-01-26 21:19 + +from django.db import migrations +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0024_auto_20210126_1336'), + ] + + operations = [ + migrations.AlterField( + model_name='impact', + name='making_a_difference', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('stories', wagtail.core.blocks.StructBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('story_text', wagtail.core.blocks.TextBlock(required=False)), ('embeded_video', wagtail.core.blocks.RawHTMLBlock(required=False))]))]))]), + ), + ] diff --git a/pages/migrations/0026_auto_20210126_1521.py b/pages/migrations/0026_auto_20210126_1521.py new file mode 100644 index 000000000..0ca6f6fef --- /dev/null +++ b/pages/migrations/0026_auto_20210126_1521.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.4 on 2021-01-26 21:21 + +from django.db import migrations +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0025_auto_20210126_1519'), + ] + + operations = [ + migrations.AlterField( + model_name='impact', + name='making_a_difference', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('stories', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StreamBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('story_text', wagtail.core.blocks.TextBlock(required=False)), ('embeded_video', wagtail.core.blocks.RawHTMLBlock(required=False))])))]))]), + ), + ] diff --git a/pages/migrations/0027_auto_20210126_1607.py b/pages/migrations/0027_auto_20210126_1607.py new file mode 100644 index 000000000..77be00836 --- /dev/null +++ b/pages/migrations/0027_auto_20210126_1607.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.4 on 2021-01-26 22:07 + +from django.db import migrations +import pages.custom_blocks +import wagtail.core.blocks +import wagtail.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0026_auto_20210126_1521'), + ] + + operations = [ + migrations.AlterField( + model_name='impact', + name='reach', + field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StreamBlock([('image', pages.custom_blocks.APIImageChooserBlock()), ('description', wagtail.core.blocks.CharBlock()), ('link_text', wagtail.core.blocks.CharBlock()), ('link_href', wagtail.core.blocks.URLBlock())])))]))]), + ), + ] diff --git a/pages/models.py b/pages/models.py index 18c702077..94095e7ec 100644 --- a/pages/models.py +++ b/pages/models.py @@ -24,7 +24,8 @@ FAQBlock, \ BookProviderBlock, \ CardBlock, \ - CardImageBlock + CardImageBlock, \ + StoryBlock from .custom_fields import Funder, \ Institutions, \ @@ -282,7 +283,7 @@ class Meta: 'pages.PrintOrder', 'pages.ResearchPage', 'pages.Careers', - 'pages.AnnualReportPage', + 'pages.Impact', 'pages.InstitutionalPartnership', 'pages.HeroJourneyPage', 'pages.InstitutionalPartnerProgramPage', @@ -1530,140 +1531,90 @@ class Careers(Page): max_count = 1 -class AnnualReportPage(Page): - improving_access = StreamField([ - ('background_image', ImageBlock()), - ('heading', blocks.CharBlock()), - ('description', blocks.RichTextBlock()), - ('give_text', blocks.CharBlock()) - ], null=True) - revolution = StreamField([ - ('heading', blocks.CharBlock()), - ('letter_body', blocks.RichTextBlock()), - ('signature_image', ImageBlock()), - ('signature_alt_text', blocks.CharBlock()), - ('signature_text', blocks.RichTextBlock()), - ('portrait', ImageBlock()), - ('portrait_alt_text', blocks.CharBlock()) - ], null=True) - founding = StreamField([ - ('caption', blocks.RichTextBlock()), - ('portrait', ImageBlock()), - ('portrait_alt_text', blocks.CharBlock()), - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ], null=True) - reach = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.RichTextBlock()), - ('facts', blocks.ListBlock(blocks.StructBlock([ - ('number', blocks.DecimalBlock()), - ('unit', blocks.CharBlock()), - ('text', blocks.CharBlock()) - ]))) - ], null=True) - testimonials = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ('testimonials', blocks.ListBlock(blocks.StructBlock([ - ('image', ImageBlock(required=False)), - ('image_alt_text', blocks.CharBlock()), - ('quote', blocks.CharBlock()), - ('link', blocks.URLBlock()), +class Impact(Page): + improving_access = StreamField( + blocks.StreamBlock([ + ('content', blocks.StructBlock([ + ('image', ImageBlock()), + ('heading', blocks.CharBlock()), + ('description', blocks.RichTextBlock()), + ('button_text', blocks.CharBlock()), + ('button_href', blocks.URLBlock()) + ]))], max_num=1)) + reach = StreamField( + blocks.StreamBlock([ + ('content', blocks.StructBlock([ + ('heading', blocks.CharBlock()), + ('description', blocks.RichTextBlock()), + ('cards', blocks.ListBlock(blocks.StreamBlock([ + ('image', APIImageChooserBlock()), + ('description', blocks.CharBlock()), + ('link_text', blocks.CharBlock()), + ('link_href', blocks.URLBlock()) + ]))) + ]))], max_num=1)) + quote = StreamField( + blocks.StreamBlock([ + ('content', blocks.StructBlock([ + ('image', ImageBlock()), + ('quote', blocks.RichTextBlock()) + ]))], max_num=1)) + making_a_difference = StreamField( + blocks.StreamBlock([ + ('content', blocks.StructBlock([ + ('heading', blocks.CharBlock()), + ('description', blocks.RichTextBlock()), + ('stories', blocks.ListBlock(StoryBlock())) + ]))], max_num=1)) + disruption = StreamField( + blocks.StreamBlock([ + ('content', blocks.StructBlock([ + ('heading', blocks.CharBlock()), + ('description', blocks.TextBlock()), + ('graph', blocks.StructBlock([ + ('top_caption', blocks.CharBlock()), + ('bottom_caption', blocks.RichTextBlock()), + ('image', ImageBlock(required=False)), + ('image_alt_text', blocks.CharBlock(required=False)), + ])) + ]))], max_num=1)) + supporter_community = StreamField( + blocks.StreamBlock([ + ('content', blocks.StructBlock([ + ('heading', blocks.CharBlock()), + ('image', ImageBlock()), + ('quote', blocks.RichTextBlock()), ('link_text', blocks.CharBlock()), - ]))) - ], null=True) - sustainability = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ('partners', blocks.ListBlock(blocks.StructBlock([ - ('image', ImageBlock(required=False)), - ('image_alt_text', blocks.CharBlock()), - ]))) - ], null=True) - disruption = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ('graph', blocks.StructBlock([ - ('top_caption', blocks.CharBlock()), - ('bottom_caption', blocks.RichTextBlock()), - ('image', ImageBlock(required=False)), - ('image_alt_text', blocks.CharBlock(required=False)), - ])) - ], null=True) - looking_ahead = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ('image', ImageBlock()), - ], null=True) - map = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ('link', blocks.CharBlock()), - ('link_text', blocks.CharBlock()), - ('background_image', ImageBlock()), - ('image_1', ImageBlock()), - ('image_2', ImageBlock()), - ], null=True) - tutor = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ('link', blocks.CharBlock()), - ('link_text', blocks.CharBlock()), - ('right_image', ImageBlock()), - ('bottom_image', ImageBlock()), - ], null=True) - philanthropic_partners = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ('image', ImageBlock()), - ('image_alt_text', blocks.CharBlock()), - ('link_1', blocks.CharBlock()), - ('link_1_text', blocks.CharBlock()), - ('link_2', blocks.CharBlock()), - ('link_2_text', blocks.CharBlock()), - ('quote', blocks.TextBlock()), - ('attribution_name', blocks.CharBlock()), - ('attribution_title', blocks.CharBlock()) - - ], null=True) - giving = StreamField([ - ('heading', blocks.CharBlock()), - ('description', blocks.TextBlock()), - ('link', blocks.CharBlock()), - ('link_text', blocks.CharBlock()), - ], null=True) - + ('link_href', blocks.URLBlock()) + ]))], max_num=1)) + giving = StreamField( + blocks.StreamBlock([ + ('content', blocks.StructBlock([ + ('heading', blocks.CharBlock()), + ('description', blocks.TextBlock()), + ('link', blocks.CharBlock()), + ('link_text', blocks.CharBlock()), + ]))], max_num=1)) content_panels = [ FieldPanel('title', classname='full title', help_text="Internal name for page."), StreamFieldPanel('improving_access'), - StreamFieldPanel('revolution'), - StreamFieldPanel('founding'), StreamFieldPanel('reach'), - StreamFieldPanel('testimonials'), - StreamFieldPanel('sustainability'), + StreamFieldPanel('quote'), + StreamFieldPanel('making_a_difference'), StreamFieldPanel('disruption'), - StreamFieldPanel('looking_ahead'), - StreamFieldPanel('map'), - StreamFieldPanel('tutor'), - StreamFieldPanel('philanthropic_partners'), + StreamFieldPanel('supporter_community'), StreamFieldPanel('giving'), ] api_fields = [ APIField('title'), APIField('improving_access'), - APIField('revolution'), - APIField('founding'), APIField('reach'), - APIField('testimonials'), - APIField('sustainability'), + APIField('quote'), + APIField('making_a_difference'), APIField('disruption'), - APIField('looking_ahead'), - APIField('map'), - APIField('tutor'), - APIField('philanthropic_partners'), + APIField('supporter_community'), APIField('giving'), APIField('slug'), APIField('seo_title'), @@ -1671,6 +1622,7 @@ class AnnualReportPage(Page): ] parent_page_type = ['pages.HomePage'] + max_count = 1 class InstitutionalPartnership(Page): From 171b670c4258f73067d2dcfeedabaee48318872a Mon Sep 17 00:00:00 2001 From: Michael Harrison Date: Tue, 26 Jan 2021 16:16:13 -0600 Subject: [PATCH 3/5] update tests --- pages/tests.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pages/tests.py b/pages/tests.py index 9bc65a995..753e6f08d 100644 --- a/pages/tests.py +++ b/pages/tests.py @@ -8,7 +8,6 @@ AboutUsPage, GeneralPage, FoundationSupport, - OurImpact, MapPage, Give, TermsOfService, @@ -28,7 +27,7 @@ ResearchPage, TeamPage, Careers, - AnnualReportPage, + Impact, InstitutionalPartnership, HeroJourneyPage, InstitutionalPartnerProgramPage, @@ -73,7 +72,6 @@ def test_allowed_subpages(self): PressIndex, BookIndex, FoundationSupport, - OurImpact, MapPage, Give, TermsOfService, @@ -93,7 +91,7 @@ def test_allowed_subpages(self): ResearchPage, TeamPage, Careers, - AnnualReportPage, + Impact, InstitutionalPartnership, HeroJourneyPage, InstitutionalPartnerProgramPage, From 7489744a95f47d502bd1062e75d720e84934e60e Mon Sep 17 00:00:00 2001 From: Michael Harrison Date: Tue, 26 Jan 2021 16:29:28 -0600 Subject: [PATCH 4/5] add management command to create impact page --- .../management/commands/create_impact_page.py | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 pages/management/commands/create_impact_page.py diff --git a/pages/management/commands/create_impact_page.py b/pages/management/commands/create_impact_page.py new file mode 100644 index 000000000..b09a3e325 --- /dev/null +++ b/pages/management/commands/create_impact_page.py @@ -0,0 +1,71 @@ +import json +from django.core.management.base import BaseCommand +from pages.models import HomePage, Impact + +class Command(BaseCommand): + help = "create initial impact page after a deployment" + + def handle(self, *args, **options): + homepage = HomePage.objects.first() # there's only one home page, so this should be okay + impact_page = Impact( + title="Our Impact", + improving_access=json.dumps([ + {"type": "content", + "value": {"heading": "Improving Educational Access and Learning for Everyone", + "description": "

Based at Rice University, OpenStax is one of the world\u2019s largest nonprofit digital learning platforms and publisher of free, open education resources. Join us and help millions of students experience an affordable, engaging education.

", + "button_text": "Give today", "button_href": "https://openstax.org/give"}} + ]), + reach=json.dumps([ + {"type": "content", "value": {"heading": "Our Reach", + "description": "

COVID-19 Impact: Demand for OpenStax more than doubled in the pandemic, so our team rapidly increased learning resources to support instructors and their students with virtual learning. Please make a gift to help us continue to meet this urgent need.

", + "cards": [[{"type": "description", + "value": "$1.2 billion saved in education costs since 2012"}, + {"type": "link_text", "value": "Read more >"}, + {"type": "link_href", "value": "https://openstax.org"}], [ + {"type": "description", + "value": "4 million students from 120 countries use OpenStax"}, + {"type": "link_text", "value": "See the map >"}, + {"type": "link_href", "value": "https://openstax.org"}], [ + {"type": "description", + "value": "60 percent of higher education institutions in US use OpenStax"}], [ + {"type": "description", + "value": "4 thousand+ K-12 schools use OpenStax"}]]}, + } + ]), + quote=json.dumps([ + {"type": "content", + "value": {"quote": "

Amidst COVID-19, educational problems are complex and in constant flux, making it critical that we support students in their learning. OpenStax is expanding its library to new subject areas, deepening student engagement with our digital learning tools, and advancing the frontiers of learning science to help make education engaging and personal. It is through this personalization that we believe we can bring greater equity and quality to education for students worldwide.

\u2013 Dr. Richard Baraniuk,

Founder of OpenStax, Victor E. Cameron Professor of Electrical and Computer Engineering at Rice University, and Fellow of the American Academy of Arts and Sciences

"}, + } + ]), + making_a_difference=json.dumps([ + {"type": "content", "value": {"heading": "Making a Difference", + "description": "

Learn more from those who have been directly impacted by OpenStax.

", + }} + ]), + disruption=json.dumps([ + {"type": "content", "value": {"heading": "Positive Disruption", + "description": "The price of textbooks is declining due to open education\u2019s disruption of the college textbook market, removing financial barriers to advanced education, and reducing student debt. According to an economist, \u201cThe \u2018textbook bubble\u2019 is finally starting to deflate, due to the creative destruction and competition from free/low-cost textbooks from groups like OpenStax\u201d (Mark Perry, AEI, 2019).", + "graph": { + "top_caption": "Consumer Price Index Educational Books and Supplies, January 1967 to September 2017", + "bottom_caption": "

https://www.aei.org/publication/wednesday-afternoon-links-30/

Published by Mark Perry on October 25, 2017, AEI.org

", + }}, + } + ]), + supporter_community=json.dumps([ + {"type": "content", "value": {"heading": "Our Supporter Community", + "quote": "

OpenStax continues to expand to new subject areas, grade levels, and languages to reach more students. Yet, OpenStax is more than free textbooks. With a team of researchers, educators, and learning engineers at Rice University, OpenStax is creating research-based learning tools to help teachers and learners better personalize the education experience. OpenStax needs your partnership to continue its impact.

\u2013 Ann Doerr, OpenStax Advisor

", + "link_text": "View our supporters", "link_href": "https://openstax.org"}, + } + ]), + giving=json.dumps([ + {"type": "content", "value": {"heading": "Students need your help today.", + "description": "Together, we can increase educational equity and quality for millions of students worldwide.", + "link": "Give today", "link_text": "https://openstax.org/give"}, + } + ]) + ) + + homepage.add_child(instance=impact_page) + revision = impact_page.save_revision() + revision.publish() + impact_page.save() From 0aa392feac8fcdf12be15148d406caf7fac1a599 Mon Sep 17 00:00:00 2001 From: Michael Harrison Date: Tue, 26 Jan 2021 16:30:39 -0600 Subject: [PATCH 5/5] add test for management command --- pages/tests.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/tests.py b/pages/tests.py index 753e6f08d..ee7e87849 100644 --- a/pages/tests.py +++ b/pages/tests.py @@ -152,6 +152,12 @@ def test_can_create_tutor_page_with_management_command(self): self.assertEqual(page_exists, True) + def test_can_create_impact_page_with_management_command(self): + call_command('create_impact_page') + page_exists = Impact.objects.all().exists() + + self.assertEqual(page_exists, True) + class ErrataListTest(WagtailPageTests): def test_can_create_errata_list_page(self):