# Generated by Django 3.2.19 on 2023-05-24 12:57

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


class Migration(migrations.Migration):
    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("core", "0081_alter_account_preferred_timezone"),
        ("comms", "0004_newsitem_support_copy_paste"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalNewsItem",
            fields=[
                (
                    "id",
                    models.IntegerField(
                        auto_created=True, blank=True, db_index=True, verbose_name="ID"
                    ),
                ),
                (
                    "support_copy_paste",
                    models.BooleanField(
                        default=True,
                        help_text="Turn this on if copy-pasting content from a word processor, or using the toolbar to format text. It tells Janeway to clear out formatting that does not play nice. Turn it off and leave it off if anyone has added custom HTML or CSS using the code view, since it might remove custom code.",
                    ),
                ),
                ("object_id", models.PositiveIntegerField(blank=True, null=True)),
                ("title", models.CharField(max_length=500)),
                ("body", models.TextField()),
                ("posted", models.DateTimeField(default=django.utils.timezone.now)),
                ("start_display", models.DateField(default=django.utils.timezone.now)),
                ("end_display", models.DateField(blank=True, null=True)),
                ("sequence", models.PositiveIntegerField(default=0)),
                (
                    "custom_byline",
                    models.CharField(
                        blank=True,
                        help_text="If you want a custom byline add it here. This will overwrite the display of the user who created the news item with whatever text is added here.",
                        max_length=255,
                        null=True,
                    ),
                ),
                ("history_id", models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField(db_index=True)),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="contenttypes.contenttype",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "large_image_file",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        help_text="An image for the top of the news item page and the "
                        "news list page. Note that it will be automatically cropped to "
                        "1500px x 648px, so wide images work best.",
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="core.file",
                    ),
                ),
                (
                    "posted_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical news item",
                "verbose_name_plural": "historical news items",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": ("history_date", "history_id"),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
