Skip to content

Commit

Permalink
squash migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
mwvolo committed Jul 16, 2024
1 parent 400d6a2 commit f61604b
Show file tree
Hide file tree
Showing 4 changed files with 275 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
# Generated by Django 5.0.7 on 2024-07-16 00:11

import django.db.models.deletion
import pages.custom_blocks
import wagtail.blocks
import wagtail.documents.blocks
import wagtail.fields
from django.db import migrations, models


class Migration(migrations.Migration):

replaces = [
("pages", "0084_customizablepage"),
("pages", "0085_customizablepage_page_layout"),
("pages", "0086_rootpage_flexiblepage_delete_customizablepage"),
("pages", "0087_alter_rootpage_body"),
("pages", "0088_alter_rootpage_body"),
("pages", "0089_alter_rootpage_body"),
("pages", "0090_rename_page_layout_rootpage_layout_and_more"),
("pages", "0091_alter_rootpage_body"),
("pages", "0092_rename_flexiblepage_flexpage_alter_rootpage_body"),
("pages", "0093_alter_rootpage_body"),
("pages", "0094_alter_rootpage_body"),
("pages", "0095_alter_rootpage_body"),
("pages", "0096_alter_rootpage_body"),
("pages", "0097_alter_rootpage_body"),
("pages", "0098_alter_rootpage_body"),
("pages", "0099_alter_rootpage_body"),
("pages", "0100_alter_rootpage_body"),
("pages", "0101_alter_rootpage_body"),
("pages", "0102_alter_rootpage_body"),
("pages", "0103_alter_rootpage_body"),
("pages", "0104_alter_rootpage_body"),
("pages", "0105_alter_rootpage_body"),
("pages", "0106_alter_rootpage_body"),
("pages", "0107_alter_rootpage_body"),
("pages", "0108_alter_rootpage_body"),
("pages", "0109_alter_rootpage_body"),
("pages", "0110_alter_rootpage_body"),
]

dependencies = [
("pages", "0083_alter_k12mainpage_testimonials"),
("snippets", "0037_pagelayout"),
("wagtailcore", "0089_log_entry_data_json_null_to_object"),
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
]

operations = [
migrations.CreateModel(
name="RootPage",
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",
),
),
(
"body",
wagtail.fields.StreamField(
[
(
"hero",
wagtail.blocks.StructBlock(
[
("text", pages.custom_blocks.APIRichTextBlock()),
("image", pages.custom_blocks.APIImageChooserBlock(required=False)),
(
"cta",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
("text", wagtail.blocks.CharBlock(required=False)),
("aria_label", wagtail.blocks.CharBlock(required=False)),
(
"target",
wagtail.blocks.StreamBlock(
[
(
"external",
wagtail.blocks.URLBlock(required=False),
),
(
"internal",
wagtail.blocks.PageChooserBlock(required=False),
),
(
"document",
wagtail.documents.blocks.DocumentChooserBlock(
required=False
),
),
],
required=False,
),
),
],
required=False,
),
label="Calls to Action",
max_num=2,
),
),
(
"config",
wagtail.blocks.StreamBlock(
[
(
"image_alignment",
wagtail.blocks.ChoiceBlock(
choices=[
("left", "Left"),
("right", "Right"),
("topLeft", "Top Left"),
("topRight", "Top Right"),
("bottomLeft", "Bottom Left"),
("bottomRight", "Bottom Right"),
]
),
),
(
"image_size",
wagtail.blocks.ChoiceBlock(
choices=[
("auto", "Auto"),
("contain", "Contain"),
("cover", "Cover"),
]
),
),
],
max_num=2,
required=False,
),
),
]
),
),
(
"section",
wagtail.blocks.StreamBlock(
[
(
"cards",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
("text", pages.custom_blocks.APIRichTextBlock()),
(
"cta",
wagtail.blocks.StructBlock(
[
("text", wagtail.blocks.CharBlock(required=False)),
(
"aria_label",
wagtail.blocks.CharBlock(required=False),
),
(
"target",
wagtail.blocks.StreamBlock(
[
(
"external",
wagtail.blocks.URLBlock(
required=False
),
),
(
"internal",
wagtail.blocks.PageChooserBlock(
required=False
),
),
(
"document",
wagtail.documents.blocks.DocumentChooserBlock(
required=False
),
),
],
required=False,
),
),
],
required=False,
),
),
]
)
),
),
(
"config",
wagtail.blocks.StreamBlock(
[
(
"corner_style",
wagtail.blocks.ChoiceBlock(
choices=[("rounded", "Rounded"), ("square", "Square")]
),
)
],
max_num=1,
),
),
("text", pages.custom_blocks.APIRichTextBlock()),
("html", wagtail.blocks.RawHTMLBlock()),
]
),
),
("html", wagtail.blocks.RawHTMLBlock()),
],
use_json_field=True,
),
),
("layout", models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to="snippets.pagelayout")),
(
"promote_image",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
),
),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="FlexPage",
fields=[
(
"rootpage_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="pages.rootpage",
),
),
],
options={
"abstract": False,
},
bases=("pages.rootpage",),
),
]
7 changes: 4 additions & 3 deletions pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@
('cover', 'Cover'),
]


class LayoutSnippetSerializer(Field):
def to_representation(self, page):
def to_representation(self, value):
return {
'layout': page.layout,
'background_image': page.background_image_api_response,
'layout': value.layout,
'background_image': value.background_image_api_response,
}


Expand Down
12 changes: 12 additions & 0 deletions pages/templates/wagtailadmin/admin_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "wagtailadmin/admin_base.html" %}
{% load static %}

{% block branding_title %}OpenStax CMS{% endblock %}

{% block branding_logo %}
<img src="{% static 'images/openstax.png' %}" alt="OpenStax CMS" width="80" />
{% endblock %}

{% block branding_favicon %}
<link rel="shortcut icon" href="https://openstax.org/dist/assets/favicon-16x16.png" />
{% endblock %}
4 changes: 0 additions & 4 deletions pages/templates/wagtailadmin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@
{% block branding_logo %}
<img src="{% static 'images/openstax.png' %}" alt="OpenStax CMS" width="80" />
{% endblock %}

{% block branding_favicon %}
<link rel="shortcut icon" href="https://openstax.org/dist/assets/favicon-16x16.png" />
{% endblock %}

0 comments on commit f61604b

Please sign in to comment.