# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations

def populate_metaplans(apps, schema_editor):
    Metaplan = apps.get_model("metaplans", "Metaplan")
    for metaplan in Metaplan.objects.all():
        metaplan.title = metaplan.template.title
        metaplan.save()


class Migration(migrations.Migration):

    dependencies = [
        ('metaplans', '0008_change_metaplan_like_template_copy'),
    ]

    operations = [
        migrations.RunPython(populate_metaplans),
        migrations.RemoveField(
            model_name='metaplan',
            name='template',
        ),
    ]
