# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-12-19 13:16
from __future__ import unicode_literals

from django.db import migrations
import mptt
import mptt.managers


def rebuild_flag_mptt_tree(apps, schema_editor):
    manager = mptt.managers.TreeManager()
    Flag = apps.get_model('shopit', 'Flag')
    manager.model = Flag
    mptt.register(Flag, order_insertion_by=['created_at'])
    manager.contribute_to_class(Flag, 'objects')
    manager.rebuild()


class Migration(migrations.Migration):

    dependencies = [
        ('shopit', '0002_make_flag_mptt_model'),
    ]

    operations = [
        migrations.RunPython(rebuild_flag_mptt_tree, lambda apps, schema_editor: None)
    ]
