# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-04 20:07
from __future__ import unicode_literals

from django.db import migrations


def create_site_and_social_app(apps, schema):
    Site = apps.get_model('sites.Site')
    site = Site.objects.first()

    if not site:
        site = Site()
    site.name = 'flashcrowd.app:8000'
    site.domain = 'flashcrowd.app:8000'

    SocialApp = apps.get_model('socialaccount.SocialApp')
    app = SocialApp.objects.create(
        provider='facebook',
        name='FlashMe App @ FaceBook',
        client_id='280018839013932',
        secret='ab864dba821bf7003c0525fbdbff502b'
    )
    site.save()
    app.sites.add(site)


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0014_auto_20160604_1750'),
        ('sites', '0001_initial'),
        ('socialaccount', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(create_site_and_social_app)
    ]
