# Generated by Django 2.2.13 on 2021-07-27 11:12

from django.db import migrations

def forward(apps, schema_editor):
    Category = apps.get_model("catalogue", "Category")
    Product = apps.get_model("catalogue", "Product")

    for c in Category._base_manager.all():
        if not c.meta_title:
            c.meta_title = c.seo_title
        if not c.meta_description:
            c.meta_description = c.seo_description

        c.save()

    for p in Product._base_manager.all():
        if not p.meta_title:
            p.meta_title = p.seo_title
        if not p.meta_description:
            p.meta_description = p.seo_description

        p.save()


class Migration(migrations.Migration):

    dependencies = [
        ('catalogue', '0023_oscar3_merge'),
    ]

    operations = [
        migrations.RunPython(forward, migrations.RunPython.noop),
    ]
