# Generated by Django 3.2.4 on 2021-08-30 15:00

from django.contrib.sites.models import Site
from django.db import migrations


sites = {
    'Retail Dive': 'retaildive.com',
    'CIO Dive': 'ciodive.com',
    'Education Dive': 'educationdive.com',
    'Supply Chain Dive': 'supplychaindive.com',
    'Restaurant Dive': 'restaurantdive.com',
    'Grocery Dive': 'grocerydive.com',
    'BioPharma Dive': 'biopharmadive.com',
    'HR Dive': 'hrdive.com',
}


def forward(apps, schema_editor):
    sid = 1
    for display_name, domain in sites.items():
        newsite = Site(
            id=sid,
            domain=domain,
            name=display_name
        )
        newsite.save()
        sid += 1


def reverse(apps, schema_editor):
    Site.objects.exclude(pk=999).delete()


class Migration(migrations.Migration):

    dependencies = [
        ('news', '0002_newspost_active'),
    ]

    operations = [
        migrations.RunPython(forward, reverse),
    ]
