# Generated by Django 5.1.1 on 2024-09-23 15:45

import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Tag",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=50)),
                ("slug", models.SlugField()),
            ],
        ),
        migrations.CreateModel(
            name="Authorship",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("order", models.PositiveIntegerField(default=0)),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "ordering": ["order"],
            },
        ),
        migrations.CreateModel(
            name="Entry",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.CharField(max_length=200)),
                ("created", models.DateTimeField(default=django.utils.timezone.now)),
                ("slug", models.SlugField()),
                ("summary", models.TextField()),
                ("body", models.TextField()),
                (
                    "card_image",
                    models.URLField(
                        blank=True,
                        help_text="URL to image for social media cards",
                        null=True,
                    ),
                ),
                (
                    "is_draft",
                    models.BooleanField(
                        default=False,
                        help_text="Draft entries do not show in index pages but can be visited directly if you know the URL",
                    ),
                ),
                (
                    "authors",
                    models.ManyToManyField(
                        through="django_plugin_blog.Authorship",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "tags",
                    models.ManyToManyField(blank=True, to="django_plugin_blog.tag"),
                ),
            ],
            options={
                "verbose_name_plural": "entries",
            },
        ),
        migrations.AddField(
            model_name="authorship",
            name="entry",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to="django_plugin_blog.entry",
            ),
        ),
    ]
