# Generated by Django 4.1.2 on 2022-10-14 16:11

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


def copy_about_page(app, _):
    AboutPage = app.get_model('palanaeum', 'AboutPage')
    HelpPage = app.get_model('palanaeum', 'HelpPage')
    for revision in AboutPage.objects.all():
        HelpPage(path='about', title='About', date=revision.date, author=revision.author, text=revision.text).save()


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('palanaeum', '0017_alter_entry_modified_by_alter_entryversion_tags_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='HelpPage',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('path', models.CharField(db_index=True, max_length=32)),
                ('date', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('title', models.CharField(max_length=32)),
                ('text', models.TextField()),
                ('author', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-date',),
            },
        ),
        migrations.RunPython(copy_about_page),
        migrations.DeleteModel(
            name='AboutPage',
        ),
    ]
