# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib.auth import get_user_model
from django.db import migrations


def add_user(*args):
    User = get_user_model()
    User(serial='__system__', full_name='System', password='!!').save()


class Migration(migrations.Migration):

    dependencies = [
        ('ideascube', '0008_user_sdb_level'),
        ('search', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(add_user, None),
    ]

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations


def add_user(apps, *args):
    User = apps.get_model('ideascube', 'User')
    User(serial='__system__', full_name='System', password='!!').save()


class Migration(migrations.Migration):

    dependencies = [
        ('ideascube', '0008_user_sdb_level'),
        ('search', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(add_user, None),
    ]

Load user from migration registry when creating system user
Load user from migration registry when creating system user

Always load models from the registry in migration files.
I hate the idea of touching a migration already released, but
this one prevents us from adding new properties to User.
If we load the User directly (not from registry) when creating
the user model, we'll try to create a user with column that does
not exist at the time of this migration.
