# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-11-17 09:30
from __future__ import unicode_literals

from datetime import date

from django.db import migrations, models

SOCIETIES = [
    {
        "name": "Charismatic Renewal",
        "description": "The Catholic Charismatic Renewal Society",
        "leader": "Benjamin Ogwuru",
        "email": "bogwuru@gmail.com",
        "phone_number": "08049862354",
        "slug": "charismatic",
    },
    {
        "name": "St Jude Society",
        "description": "Saint Jude Society",
        "leader":"Jude Nnadozie",
        "email": "juddyblaize@yahoo.com",
        "phone_number": "08129982354",
        "slug": "stjude",
    },
    {
        "name": "St Anthony of Padua",
        "description": "Saint Anthony of Padua society",
        "leader": "Anthony Okoli",
        "email": "okolia@yahoo.com",
        "phone_number": "08024572354",
        "slug": "stanthony",
    },
]

def add_society_data(apps, schema_editor):
    Society = apps.get_model('people', 'Society')
    for society in SOCIETIES:
        society_object = Society.objects.create(
            name=society['name'],
            description=society['description'],
            leader=society['leader'],
            email=society['email'],
            phone_number=society['phone_number'],
            slug=society['slug'])

def remove_society_data(apps, schema_editor):
    Society = apps.get_model('people', 'Society')
    for society in SOCIETIES:
        society_object = Society.objects.get(slug=society['slug'])
        society_object.delete()

class Migration(migrations.Migration):

    dependencies = [
        ('people', '0002_auto_20171110_0914'),
    ]

    operations = [
        migrations.RunPython(
            add_society_data,
            remove_society_data)
    ]
