# Generated by Django 2.0.7 on 2018-08-12 11:35
from django.contrib.auth.models import User  # where User lives
import os
from django.utils import timezone
from settings_secret import admin_pws
from django.db import migrations


def init_room(apps, schema_editor):
    Room = apps.get_model('app', 'Room')
    room, created = Room.objects.get_or_create(title="main", staff_only=False)
    room.save()


def forwards_func(apps, schema_editor):
    # build the user you now have access to via Django magic
    User.objects.create_superuser('admin', "werbeskip@gmail.com", admin_pws, last_login=timezone.now(), is_active=True,
                                  first_name="admin", date_joined=timezone.now(), last_name="admin")


class Migration(migrations.Migration):
    dependencies = [
        ('app', '0001_initial'),
        ('auth', '__first__'),
    ]

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