# Generated by Django 3.1.6 on 2021-03-22 00:20

import django.db.models.deletion
import ulid2
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ("community", "0015_add_community_site_background_image"),
    ]

    operations = [
        migrations.CreateModel(
            name="PackageListingSection",
            fields=[
                ("datetime_created", models.DateTimeField(auto_now_add=True)),
                ("datetime_updated", models.DateTimeField(auto_now=True)),
                (
                    "uuid",
                    models.UUIDField(
                        default=ulid2.generate_ulid_as_uuid,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Name of the section, for display purposes only",
                        max_length=256,
                    ),
                ),
                ("slug", models.SlugField()),
                ("is_listed", models.BooleanField(default=True)),
                (
                    "priority",
                    models.IntegerField(
                        default=0,
                        help_text="Priority of the section. Highest priority section will be shown by default.",
                    ),
                ),
                (
                    "community",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="package_listing_sections",
                        to="community.community",
                    ),
                ),
                (
                    "exclude_categories",
                    models.ManyToManyField(
                        blank=True,
                        related_name="excluded_on_package_listing_filters",
                        to="community.PackageCategory",
                    ),
                ),
                (
                    "require_categories",
                    models.ManyToManyField(
                        blank=True,
                        related_name="required_on_package_listing_filters",
                        to="community.PackageCategory",
                    ),
                ),
            ],
        ),
        migrations.AddConstraint(
            model_name="packagelistingsection",
            constraint=models.UniqueConstraint(
                fields=("community", "slug"), name="unique_slug_per_community"
            ),
        ),
    ]
