new_contents: # -*- coding: utf-8 -*-
  # Generated by Django 1.9.6 on 2016-05-20 02:26
  from __future__ import unicode_literals
  
  from django.db import migrations
  
  from dartcms.apps.modules.models import Module, ModuleGroup
  
  MODULE_GROUPS = [
      {
          'sort': 4,
          'description': '',
          'fa': 'fa-rocket',
          'slug': 'ads',
          'name': 'Advertising',
          'modules': [
              {
                  'sort': 1,
                  'is_enabled': True,
                  'name': 'Ad banners',
                  'slug': 'ad',
                  'description': ''
              },
              {
                  'sort': 2,
                  'is_enabled': True,
                  'name': 'Ad places',
                  'slug': 'adplace',
                  'description': ''
              },
              {
                  'sort': 3,
                  'is_enabled': True,
                  'name': 'Ad sections',
                  'slug': 'adsection',
                  'description': ''
              }
          ]
      }
  ]
  
  
  def insert_modules(apps, schema):
      for group in MODULE_GROUPS:
          group_modules = group.pop('modules', [])
          group = ModuleGroup.objects.create(**group)
          for module in group_modules:
              module['group'] = group
              Module.objects.create(**module)
  
  
  def delete_modules(apps, schema):
      for group in MODULE_GROUPS:
          ModuleGroup.objects.get(slug=group['slug']).delete()
  
  
  class Migration(migrations.Migration):
      dependencies = [
          ('modules', '0003_insert_modules'),
      ]
  
      operations = [
          migrations.RunPython(insert_modules, delete_modules)
      ]
  
subject: Add migration for Ads modules