Change to content to Orderable

This commit is contained in:
2024-09-16 20:16:16 +02:00
parent a70db94b2b
commit d1fe5bb187
37 changed files with 718 additions and 371 deletions

View File

@@ -0,0 +1,44 @@
# Generated by Django 5.0.8 on 2024-09-16 12:57
import django.db.models.deletion
import modelcluster.fields
import wagtail.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('about', '0003_rename_af1img_aboutpage_section_one_img_and_more'),
('wagtailimages', '0026_delete_uploadedimage'),
]
operations = [
migrations.RemoveField(
model_name='aboutpage',
name='section_two_img',
),
migrations.RemoveField(
model_name='aboutpage',
name='section_two_text',
),
migrations.RemoveField(
model_name='aboutpage',
name='section_two_title',
),
migrations.CreateModel(
name='AboutPageSections',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('section_title', wagtail.fields.RichTextField(blank=True)),
('section_text', wagtail.fields.RichTextField(blank=True)),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='sections_about', to='about.aboutpage')),
('section_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
]

View File

@@ -0,0 +1,28 @@
# Generated by Django 5.0.8 on 2024-09-16 12:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('about', '0004_remove_aboutpage_section_two_img_and_more'),
]
operations = [
migrations.RenameField(
model_name='aboutpage',
old_name='section_one_img',
new_name='intro_image',
),
migrations.RenameField(
model_name='aboutpage',
old_name='section_one_text',
new_name='intro_text',
),
migrations.RenameField(
model_name='aboutpage',
old_name='section_one_title',
new_name='intro_title',
),
]

View File

@@ -0,0 +1,32 @@
# Generated by Django 5.0.8 on 2024-09-16 13:54
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('about', '0005_rename_section_one_img_aboutpage_intro_image_and_more'),
]
operations = [
migrations.AddField(
model_name='aboutpage',
name='section_one_image',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='aboutpage',
name='section_one_text',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='aboutpage',
name='section_one_title',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.DeleteModel(
name='AboutPageSections',
),
]

View File

@@ -10,25 +10,25 @@ from saburly.custom_editor import FULL_EDITOR
class AboutPage(Page):
intro_title = RichTextField(blank=True, features=FULL_EDITOR)
intro_text = RichTextField(blank=True, features=FULL_EDITOR)
intro_image = RichTextField(blank=True, features=FULL_EDITOR)
section_one_title = RichTextField(blank=True, features=FULL_EDITOR)
section_one_text = RichTextField(blank=True, features=FULL_EDITOR)
section_one_img = RichTextField(blank=True, features=FULL_EDITOR)
section_two_title = RichTextField(blank=True, features=FULL_EDITOR)
section_two_text = RichTextField(blank=True, features=FULL_EDITOR)
section_two_img = RichTextField(blank=True, features=FULL_EDITOR)
section_one_image = RichTextField(blank=True, features=FULL_EDITOR)
content_panels = Page.content_panels + [
MultiFieldPanel([
FieldPanel('section_one_title', classname="full"),
FieldPanel('section_one_text', classname="full"),
FieldPanel('section_one_img', classname="full"),
], heading="Section One"),
FieldPanel('intro_title', classname="full"),
FieldPanel('intro_text', classname="full"),
FieldPanel('intro_image', classname="full"),
], heading="Intro"),
MultiFieldPanel([
FieldPanel('section_two_title', classname="full"),
FieldPanel('section_two_text', classname="full"),
FieldPanel('section_two_img', classname="full"),
], heading="Section Two"),
FieldPanel('section_one_title', classname="full"),
FieldPanel('section_one_text', classname="full"),
FieldPanel('section_one_image', classname="full"),
], heading="Section One"),
]