104 lines
4.0 KiB
Python
104 lines
4.0 KiB
Python
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("pages", "0003_faqentry_answer_format"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="AboutSection",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
(
|
|
"section_type",
|
|
models.CharField(
|
|
choices=[
|
|
("hero", "Hero"),
|
|
("intro", "Intro Card"),
|
|
("grid", "Grid Cards"),
|
|
("history", "History Block"),
|
|
("custom", "Custom Content"),
|
|
],
|
|
default="custom",
|
|
max_length=30,
|
|
),
|
|
),
|
|
("badge", models.CharField(blank=True, max_length=100)),
|
|
("title", models.CharField(blank=True, max_length=300)),
|
|
(
|
|
"subtitle",
|
|
models.CharField(
|
|
blank=True,
|
|
help_text="Used as subtitle in Hero and year in History.",
|
|
max_length=500,
|
|
),
|
|
),
|
|
("content", models.TextField(blank=True)),
|
|
(
|
|
"content_format",
|
|
models.CharField(
|
|
choices=[
|
|
("plain", "Plain Text"),
|
|
("markdown", "Markdown"),
|
|
("html", "HTML"),
|
|
],
|
|
default="markdown",
|
|
max_length=20,
|
|
),
|
|
),
|
|
("order", models.PositiveIntegerField(default=0)),
|
|
("is_active", models.BooleanField(default=True)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
],
|
|
options={
|
|
"verbose_name": "About Section",
|
|
"verbose_name_plural": "About Sections",
|
|
"ordering": ["order"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="AboutSectionItem",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
(
|
|
"section",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="items",
|
|
to="pages.aboutsection",
|
|
),
|
|
),
|
|
("badge", models.CharField(blank=True, max_length=100)),
|
|
("title", models.CharField(blank=True, max_length=300)),
|
|
(
|
|
"content",
|
|
models.TextField(
|
|
blank=True,
|
|
help_text="Description text or link label for History links.",
|
|
),
|
|
),
|
|
("url", models.URLField(blank=True, help_text="Used for History block links.")),
|
|
("image", models.ImageField(blank=True, null=True, upload_to="about/")),
|
|
("image_alt", models.CharField(blank=True, max_length=200)),
|
|
(
|
|
"is_featured",
|
|
models.BooleanField(
|
|
default=False,
|
|
help_text="Mark as featured item (e.g. large screenshot).",
|
|
),
|
|
),
|
|
("order", models.PositiveIntegerField(default=0)),
|
|
],
|
|
options={
|
|
"verbose_name": "About Section Item",
|
|
"verbose_name_plural": "About Section Items",
|
|
"ordering": ["order"],
|
|
},
|
|
),
|
|
]
|