# Generated by Django 3.2.7 on 2021-09-13 15:40

import django.core.validators
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Page",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "language_code",
                    models.CharField(
                        choices=[("", "")],
                        default="en",
                        max_length=10,
                        verbose_name="language",
                    ),
                ),
                (
                    "page_type",
                    models.CharField(
                        choices=[("", "")],
                        default="standard",
                        max_length=100,
                        verbose_name="page type",
                    ),
                ),
                (
                    "app_namespace",
                    models.CharField(
                        blank=True,
                        editable=False,
                        max_length=100,
                        verbose_name="app instance namespace",
                    ),
                ),
                (
                    "is_active",
                    models.BooleanField(default=True, verbose_name="is active"),
                ),
                ("title", models.CharField(max_length=200, verbose_name="title")),
                ("slug", models.SlugField(verbose_name="slug")),
                (
                    "position",
                    models.PositiveIntegerField(
                        db_index=True,
                        editable=False,
                        validators=[
                            django.core.validators.MinValueValidator(
                                limit_value=1,
                                message="Position is expected to be greater than zero.",
                            )
                        ],
                    ),
                ),
                (
                    "static_path",
                    models.BooleanField(
                        default=False, verbose_name="manually define the path"
                    ),
                ),
                (
                    "path",
                    models.CharField(
                        blank=True,
                        help_text="Generated automatically if 'static path' is unset.",
                        max_length=1000,
                        validators=[
                            django.core.validators.RegexValidator(
                                message="Path must start and end with a slash (/).",
                                regex="^/(|.+/)$",
                            )
                        ],
                        verbose_name="path",
                    ),
                ),
                (
                    "parent",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="children",
                        to="testapp.page",
                        verbose_name="parent",
                    ),
                ),
                (
                    "translation_of",
                    models.ForeignKey(
                        blank=True,
                        limit_choices_to={"language_code": "en"},
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to="testapp.page",
                        verbose_name="translation of",
                    ),
                ),
            ],
            options={
                "verbose_name": "page",
                "verbose_name_plural": "pages",
                "ordering": ["position"],
                "abstract": False,
                "unique_together": {("language_code", "path")},
            },
        ),
        migrations.CreateModel(
            name="Snippet",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "template_name",
                    models.CharField(
                        choices=[("", "")], max_length=100, verbose_name="template"
                    ),
                ),
                ("region", models.CharField(max_length=255)),
                ("ordering", models.IntegerField(default=0)),
                (
                    "parent",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="testapp_snippet_set",
                        to="testapp.page",
                    ),
                ),
            ],
            options={
                "verbose_name": "predefined snippet",
                "verbose_name_plural": "predefined snippets",
                "abstract": False,
            },
        ),
    ]
