# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-05 05:21
from __future__ import unicode_literals

from django.db import migrations

from dartcms.utils.loading import get_model


PageModule = get_model('pages', 'PageModule')

PAGE_MODULES = [
    {'slug': 'feeds', 'name': 'Feeds'},
    {'slug': 'contacts', 'name': 'Contacts'},
    {'slug': 'shop', 'name': 'Shop'},
    {'slug': 'page', 'name': 'Static Page'},
]


def insert_pagemodules(apps, schema):
    for m in PAGE_MODULES:
        PageModule.objects.create(**m)


def drop_pagemodules(apps, schema):
    for m in PAGE_MODULES:
        PageModule.objects.filter(slug=m['slug']).delete()


class Migration(migrations.Migration):
    dependencies = [
        ('pages', '0002_insert_homepage'),
    ]

    operations = [
        migrations.RunPython(insert_pagemodules, drop_pagemodules)
    ]
