diff --git a/bin/post_compile b/bin/post_compile index 58df739..bfa7c53 100755 --- a/bin/post_compile +++ b/bin/post_compile @@ -4,7 +4,5 @@ set -eo pipefail # Exit at first error, including in a pipeline set -u # Consider unset variables as errors set -x # Print each command before executing it - -python djangosocial/manage.py python djangosocial/manage.py tailwind build python djangosocial/manage.py collectstatic --noinput diff --git a/dev-templates/docker-compose.override.yml.tpl b/dev-templates/docker-compose.override.yml.tpl index cbbca8a..8b663fb 100644 --- a/dev-templates/docker-compose.override.yml.tpl +++ b/dev-templates/docker-compose.override.yml.tpl @@ -2,6 +2,7 @@ services: djangosocial-django: build: + context: ./djangosocial target: django-dev environment: - DJANGO_DEBUG=True diff --git a/djangosocial/home/migrations/0020_alter_aboutpage_body_alter_homepage_body.py b/djangosocial/home/migrations/0020_alter_aboutpage_body_alter_homepage_body.py new file mode 100644 index 0000000..0b98d8e --- /dev/null +++ b/djangosocial/home/migrations/0020_alter_aboutpage_body_alter_homepage_body.py @@ -0,0 +1,28 @@ +# Generated by Django 4.2.13 on 2024-06-03 13:37 + +from django.db import migrations +import wagtail.admin.forms.choosers +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +import wagtail.images.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0019_alter_homepage_body'), + ] + + operations = [ + migrations.AlterField( + model_name='aboutpage', + name='body', + field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.RichTextBlock()), ('hero_image', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(help_text='The image to display.', required=True))])), ('timeline', wagtail.blocks.StructBlock([('timeline_moments', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('date', wagtail.blocks.DateBlock()), ('title', wagtail.blocks.CharBlock()), ('description', wagtail.blocks.TextBlock())])))])), ('stats', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('stats', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.CharBlock()), ('title', wagtail.blocks.CharBlock()), ('description', wagtail.blocks.TextBlock()), ('size', wagtail.blocks.ChoiceBlock(choices=[('small', 'Small'), ('medium', 'Medium'), ('large', 'Large')]))]), max_num=3))])), ('hero', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock(help_text='The image to display.', required=True))])), ('content_list', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock()), ('list_title', wagtail.blocks.CharBlock()), ('list_type', wagtail.blocks.CharBlock(help_text='What does the list of represent? (eg roles, events)')), ('content_list', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('link', wagtail.blocks.StructBlock([('link_to', wagtail.blocks.ChoiceBlock(choices=[('page', 'Page'), ('file', 'File'), ('custom_url', 'Custom URL'), ('email', 'Email'), ('anchor', 'Anchor'), ('phone', 'Phone')], classname='link_choice_type_selector', label='Link to', required=False)), ('page', wagtail.blocks.PageChooserBlock(form_classname='page_link', label='Page', required=False)), ('file', wagtail.documents.blocks.DocumentChooserBlock(form_classname='file_link', label='File', required=False)), ('custom_url', wagtail.blocks.CharBlock(form_classname='custom_url_link url_field', label='Custom URL', max_length=300, required=False, validators=[wagtail.admin.forms.choosers.URLOrAbsolutePathValidator()])), ('anchor', wagtail.blocks.CharBlock(form_classname='anchor_link', label='#', max_length=300, required=False)), ('email', wagtail.blocks.EmailBlock(required=False)), ('phone', wagtail.blocks.CharBlock(form_classname='phone_link', label='Phone', max_length=30, required=False)), ('new_window', wagtail.blocks.BooleanBlock(form_classname='new_window_toggle', label='Open in new window', required=False))]))]), max_num=3)), ('more_list_text', wagtail.blocks.CharBlock()), ('more_list_link', wagtail.blocks.StructBlock([('link_to', wagtail.blocks.ChoiceBlock(choices=[('page', 'Page'), ('file', 'File'), ('custom_url', 'Custom URL'), ('email', 'Email'), ('anchor', 'Anchor'), ('phone', 'Phone')], classname='link_choice_type_selector', label='Link to', required=False)), ('page', wagtail.blocks.PageChooserBlock(form_classname='page_link', label='Page', required=False)), ('file', wagtail.documents.blocks.DocumentChooserBlock(form_classname='file_link', label='File', required=False)), ('custom_url', wagtail.blocks.CharBlock(form_classname='custom_url_link url_field', label='Custom URL', max_length=300, required=False, validators=[wagtail.admin.forms.choosers.URLOrAbsolutePathValidator()])), ('anchor', wagtail.blocks.CharBlock(form_classname='anchor_link', label='#', max_length=300, required=False)), ('email', wagtail.blocks.EmailBlock(required=False)), ('phone', wagtail.blocks.CharBlock(form_classname='phone_link', label='Phone', max_length=30, required=False)), ('new_window', wagtail.blocks.BooleanBlock(form_classname='new_window_toggle', label='Open in new window', required=False))]))])), ('content_with_images', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('secondary_paragraph', wagtail.blocks.TextBlock()), ('top_image', wagtail.images.blocks.ImageChooserBlock()), ('bottom_left_image', wagtail.images.blocks.ImageChooserBlock()), ('bottom_center_image', wagtail.images.blocks.ImageChooserBlock()), ('bottom_right_image', wagtail.images.blocks.ImageChooserBlock())])), ('logo_cloud', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('logos', wagtail.blocks.ListBlock(wagtail.images.blocks.ImageChooserBlock()))]))], null=True, use_json_field=True), + ), + migrations.AlterField( + model_name='homepage', + name='body', + field=wagtail.fields.StreamField([('rich_text', wagtail.blocks.RichTextBlock()), ('hero_image', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(help_text='The image to display.', required=True))])), ('gallery', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='An optional title for the gallery.', max_length=50, required=False)), ('images', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(help_text='Choose an image.', required=True)), ('caption', wagtail.blocks.CharBlock(help_text='An optional caption for the image.', required=False))])))])), ('timeline', wagtail.blocks.StructBlock([('timeline_moments', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('date', wagtail.blocks.DateBlock()), ('title', wagtail.blocks.CharBlock()), ('description', wagtail.blocks.TextBlock())])))])), ('stats', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('stats', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('number', wagtail.blocks.CharBlock()), ('title', wagtail.blocks.CharBlock()), ('description', wagtail.blocks.TextBlock()), ('size', wagtail.blocks.ChoiceBlock(choices=[('small', 'Small'), ('medium', 'Medium'), ('large', 'Large')]))]), max_num=3))])), ('hero', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock(help_text='The image to display.', required=True))])), ('content_list', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock()), ('list_title', wagtail.blocks.CharBlock()), ('list_type', wagtail.blocks.CharBlock(help_text='What does the list of represent? (eg roles, events)')), ('content_list', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('link', wagtail.blocks.StructBlock([('link_to', wagtail.blocks.ChoiceBlock(choices=[('page', 'Page'), ('file', 'File'), ('custom_url', 'Custom URL'), ('email', 'Email'), ('anchor', 'Anchor'), ('phone', 'Phone')], classname='link_choice_type_selector', label='Link to', required=False)), ('page', wagtail.blocks.PageChooserBlock(form_classname='page_link', label='Page', required=False)), ('file', wagtail.documents.blocks.DocumentChooserBlock(form_classname='file_link', label='File', required=False)), ('custom_url', wagtail.blocks.CharBlock(form_classname='custom_url_link url_field', label='Custom URL', max_length=300, required=False, validators=[wagtail.admin.forms.choosers.URLOrAbsolutePathValidator()])), ('anchor', wagtail.blocks.CharBlock(form_classname='anchor_link', label='#', max_length=300, required=False)), ('email', wagtail.blocks.EmailBlock(required=False)), ('phone', wagtail.blocks.CharBlock(form_classname='phone_link', label='Phone', max_length=30, required=False)), ('new_window', wagtail.blocks.BooleanBlock(form_classname='new_window_toggle', label='Open in new window', required=False))]))]), max_num=3)), ('more_list_text', wagtail.blocks.CharBlock()), ('more_list_link', wagtail.blocks.StructBlock([('link_to', wagtail.blocks.ChoiceBlock(choices=[('page', 'Page'), ('file', 'File'), ('custom_url', 'Custom URL'), ('email', 'Email'), ('anchor', 'Anchor'), ('phone', 'Phone')], classname='link_choice_type_selector', label='Link to', required=False)), ('page', wagtail.blocks.PageChooserBlock(form_classname='page_link', label='Page', required=False)), ('file', wagtail.documents.blocks.DocumentChooserBlock(form_classname='file_link', label='File', required=False)), ('custom_url', wagtail.blocks.CharBlock(form_classname='custom_url_link url_field', label='Custom URL', max_length=300, required=False, validators=[wagtail.admin.forms.choosers.URLOrAbsolutePathValidator()])), ('anchor', wagtail.blocks.CharBlock(form_classname='anchor_link', label='#', max_length=300, required=False)), ('email', wagtail.blocks.EmailBlock(required=False)), ('phone', wagtail.blocks.CharBlock(form_classname='phone_link', label='Phone', max_length=30, required=False)), ('new_window', wagtail.blocks.BooleanBlock(form_classname='new_window_toggle', label='Open in new window', required=False))]))])), ('content_with_images', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('secondary_paragraph', wagtail.blocks.TextBlock()), ('top_image', wagtail.images.blocks.ImageChooserBlock()), ('bottom_left_image', wagtail.images.blocks.ImageChooserBlock()), ('bottom_center_image', wagtail.images.blocks.ImageChooserBlock()), ('bottom_right_image', wagtail.images.blocks.ImageChooserBlock())])), ('logo_cloud', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('lead_paragraph', wagtail.blocks.TextBlock()), ('logos', wagtail.blocks.ListBlock(wagtail.images.blocks.ImageChooserBlock()))]))], null=True, use_json_field=True), + ), + ] diff --git a/djangosocial/requirements.in b/djangosocial/requirements.in index a5d6f6b..f7b1b89 100644 --- a/djangosocial/requirements.in +++ b/djangosocial/requirements.in @@ -7,3 +7,4 @@ whitenoise==6.6.0 dj-database-url==2.1.0 django-tailwind-cli django-browser-reload +wagtail-link-block diff --git a/djangosocial/requirements.txt b/djangosocial/requirements.txt index dea9e11..d416a40 100644 --- a/djangosocial/requirements.txt +++ b/djangosocial/requirements.txt @@ -147,6 +147,7 @@ django==4.2.13 \ # django-typer # djangorestframework # wagtail + # wagtail-link-block django-browser-reload==1.12.1 \ --hash=sha256:08b457f1b6599bf782d4d2ecdfb0897d6fc936ac4035060d0269c2af5ef4ef7a \ --hash=sha256:875b6bd01db13380522ccb4ae75871a2edeae74bb5ac92bf32eb76763d575d86 @@ -470,6 +471,12 @@ urllib3==2.2.1 \ wagtail==5.2.5 \ --hash=sha256:15800e17bd03244e023d2b9d70f02a51623982c3ef1ddb121925a884d625b5bb \ --hash=sha256:576f7690ca997b0e6d9fda9880594bf4bb904117b6edd5f2d7fbab570feee5a3 + # via + # -r requirements.in + # wagtail-link-block +wagtail-link-block==1.1.7 \ + --hash=sha256:5b7346bd60b65b00d7bafa48ab3b54b09c97abd085c0afd8f691be3219ff7a1c \ + --hash=sha256:e2f0c9dedd8e1116fc347e8d5a28164376d121fa95b9c87a85ca408fc426846e # via -r requirements.in webencodings==0.5.1 \ --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \ diff --git a/djangosocial/settings/base.py b/djangosocial/settings/base.py index c410959..e53d8f1 100644 --- a/djangosocial/settings/base.py +++ b/djangosocial/settings/base.py @@ -50,6 +50,7 @@ "django.contrib.staticfiles", "django_tailwind_cli", "django_browser_reload", + "wagtail_link_block", "home", "search", "streams", diff --git a/djangosocial/streams/blocks.py b/djangosocial/streams/blocks.py index c89933b..0598f4c 100644 --- a/djangosocial/streams/blocks.py +++ b/djangosocial/streams/blocks.py @@ -9,6 +9,7 @@ StructBlock, TextBlock, ) +from wagtail_link_block.blocks import LinkBlock from wagtail.images.blocks import ImageChooserBlock @@ -110,7 +111,7 @@ class Meta: class ContentListItemBlock(StructBlock): title = CharBlock() lead_paragraph = TextBlock() - link = PageChooserBlock() + link = LinkBlock() class ContentListBlock(StructBlock): @@ -125,7 +126,7 @@ class ContentListBlock(StructBlock): content_list = ListBlock(ContentListItemBlock(), max_num=3) more_list_text = CharBlock() - more_list_link = PageChooserBlock() + more_list_link = LinkBlock() class Meta: template = "blocks/content_with_list.html" diff --git a/djangosocial/streams/templates/blocks/content_with_list.html b/djangosocial/streams/templates/blocks/content_with_list.html index dbd3eed..b2a35ed 100644 --- a/djangosocial/streams/templates/blocks/content_with_list.html +++ b/djangosocial/streams/templates/blocks/content_with_list.html @@ -29,7 +29,7 @@