diff --git a/core/migrations/0012_aboutuspage.py b/core/migrations/0012_aboutuspage.py new file mode 100644 index 0000000..2c1adf4 --- /dev/null +++ b/core/migrations/0012_aboutuspage.py @@ -0,0 +1,37 @@ +# Generated by Django 5.2 on 2025-04-29 12:32 + +import django.db.models.deletion +import wagtail.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0011_alter_contactformfield_choices_and_more'), + ('wagtailcore', '0094_alter_page_locale'), + ] + + operations = [ + migrations.CreateModel( + name='AboutUsPage', + 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')), + ('company_intro', wagtail.fields.RichTextField(blank=True, help_text='Introductory text about the company')), + ('mission_title', models.CharField(blank=True, max_length=255)), + ('mission_text', wagtail.fields.RichTextField(blank=True)), + ('vision_title', models.CharField(blank=True, max_length=255)), + ('vision_text', wagtail.fields.RichTextField(blank=True)), + ('history_title', models.CharField(blank=True, max_length=255)), + ('history_text', wagtail.fields.RichTextField(blank=True)), + ('team_title', models.CharField(blank=True, max_length=255)), + ('team_intro', wagtail.fields.RichTextField(blank=True)), + ('team_members', wagtail.fields.StreamField([('team_member', 5)], blank=True, block_lookup={0: ('wagtail.blocks.CharBlock', (), {'max_length': 255}), 1: ('wagtail.images.blocks.ImageChooserBlock', (), {'required': False}), 2: ('wagtail.blocks.RichTextBlock', (), {'required': False}), 3: ('wagtail.blocks.EmailBlock', (), {'required': False}), 4: ('wagtail.blocks.URLBlock', (), {'required': False}), 5: ('wagtail.blocks.StructBlock', [[('name', 0), ('position', 0), ('photo', 1), ('bio', 2), ('email', 3), ('linkedin', 4), ('xing', 4)]], {})}, null=True)), + ('additional_content', wagtail.fields.StreamField([('heading', 0), ('paragraph', 1), ('image', 2), ('quote', 5)], blank=True, block_lookup={0: ('wagtail.blocks.CharBlock', (), {'form_classname': 'full title'}), 1: ('wagtail.blocks.RichTextBlock', (), {}), 2: ('wagtail.images.blocks.ImageChooserBlock', (), {}), 3: ('wagtail.blocks.TextBlock', (), {}), 4: ('wagtail.blocks.CharBlock', (), {'required': False}), 5: ('wagtail.blocks.StructBlock', [[('quote', 3), ('attribution', 4)]], {})}, null=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + ] diff --git a/core/models.py b/core/models.py index 8876290..8cb96c3 100644 --- a/core/models.py +++ b/core/models.py @@ -519,3 +519,74 @@ class UploadedScript(TimeStampedModel): out = super().delete(*args, **kwargs) storage.delete(path) return out + + +class AboutUsPage(Page): + """ + A page for displaying company information, team members, mission statements, etc. + """ + # Company information + company_intro = RichTextField( + blank=True, + help_text="Introductory text about the company" + ) + + # Mission and vision + mission_title = models.CharField(max_length=255, blank=True) + mission_text = RichTextField(blank=True) + vision_title = models.CharField(max_length=255, blank=True) + vision_text = RichTextField(blank=True) + + # Company history + history_title = models.CharField(max_length=255, blank=True) + history_text = RichTextField(blank=True) + + # Team members section + team_title = models.CharField(max_length=255, blank=True) + team_intro = RichTextField(blank=True) + + # Team members as a StreamField to allow adding multiple team members + team_members = StreamField([ + ('team_member', blocks.StructBlock([ + ('name', blocks.CharBlock(max_length=255)), + ('position', blocks.CharBlock(max_length=255)), + ('photo', ImageChooserBlock(required=False)), + ('bio', blocks.RichTextBlock(required=False)), + ('email', blocks.EmailBlock(required=False)), + ('linkedin', blocks.URLBlock(required=False)), + ('xing', blocks.URLBlock(required=False)), + ])), + ], null=True, blank=True, use_json_field=True) + + # Additional content + additional_content = StreamField([ + ('heading', blocks.CharBlock(form_classname="full title")), + ('paragraph', blocks.RichTextBlock()), + ('image', ImageChooserBlock()), + ('quote', blocks.StructBlock([ + ('quote', blocks.TextBlock()), + ('attribution', blocks.CharBlock(required=False)), + ])), + ], null=True, blank=True, use_json_field=True) + + +AboutUsPage.content_panels = [ + FieldPanel('title', classname="full title"), + FieldPanel('company_intro', classname="full"), + MultiFieldPanel([ + FieldPanel('mission_title', classname="full"), + FieldPanel('mission_text', classname="full"), + FieldPanel('vision_title', classname="full"), + FieldPanel('vision_text', classname="full"), + ], heading="Mission and Vision", classname="collapsible"), + MultiFieldPanel([ + FieldPanel('history_title', classname="full"), + FieldPanel('history_text', classname="full"), + ], heading="Company History", classname="collapsible"), + MultiFieldPanel([ + FieldPanel('team_title', classname="full"), + FieldPanel('team_intro', classname="full"), + FieldPanel('team_members'), + ], heading="Team Members", classname="collapsible"), + FieldPanel('additional_content', classname="full"), +] diff --git a/core/templates/core/about_us_page.html b/core/templates/core/about_us_page.html new file mode 100644 index 0000000..4821dbe --- /dev/null +++ b/core/templates/core/about_us_page.html @@ -0,0 +1,108 @@ +{% extends "core/base.html" %} +{% load core_tags menu_tags static wagtailuserbar wagtailcore_tags wagtailimages_tags %} + +{% block content %} +
{{ block.value.bio|richtext }}
+ {% endif %} +++ {% endif %} + {% endfor %} +{{ block.value.quote }}
+ {% if block.value.attribution %} + {{ block.value.attribution }} + {% endif %} +