# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-22 18:17
from __future__ import unicode_literals
from django.conf import settings
from django.contrib import auth

from django.db import migrations

def forwards_func(apps, schema_editor):
    # We get the model from the versioned app registry;
    # if we directly import it, it'll be the wrong version
    Post = apps.get_model("blogpractica", "Post")
    User = apps.get_model("auth", "User")

    db_alias = schema_editor.connection.alias

    user = User.objects.create(email="admin2@admin2.com", username="admin2")
    Post.objects.using(db_alias).bulk_create([
        Post(title="PyConAr 2018", author=user, text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."),
        Post(title="DjangoGirls 2018", author=user, text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."),
    ])

def reverse_func(apps, schema_editor):
    # forwards_func() creates two Country instances,
    # so reverse_func() should delete them.
    Post = apps.get_model("blogpractica", "Post")
    db_alias = schema_editor.connection.alias
    Post.objects.using(db_alias).filter(title="PyConAr 2018").delete()
    Post.objects.using(db_alias).filter(title="DjangoGirls 2018").delete()

class Migration(migrations.Migration):

    dependencies = [
        ('blogpractica', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(forwards_func, reverse_func),
    ]
