mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-16 09:34:03 +01:00
Replace fixtures by migrations.
This commit is contained in:
@@ -1 +0,0 @@
|
||||
[{"pk": 1, "model": "core.user", "fields": {"username": "admin", "first_name": "", "last_name": "", "is_active": true, "is_superuser": true, "is_staff": false, "last_login": "2012-01-26T15:19:26+01:00", "groups": [], "user_permissions": [], "password": "{CRYPT}dTTsGDkA5ZHKg", "email": "", "date_joined": "2012-01-26T15:19:26+01:00"}},{"pk": 1, "model": "core.objectaccess", "fields": {"is_owner": true, "user": 1, "content_type": ["core", "user"], "object_id": 1}}]
|
||||
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
def load_initial_data(apps, schema_editor):
|
||||
"""Load initial data."""
|
||||
User = apps.get_model("core", "User")
|
||||
user = User(username="admin", is_superuser=True)
|
||||
user.set_password("password")
|
||||
user.save()
|
||||
|
||||
ObjectAccess = apps.get_model("core", "ObjectAccess")
|
||||
ObjectAccess.objects.create(user=user, content_object=user, is_owner=True)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(load_initial_data)
|
||||
]
|
||||
+1
-1
@@ -7,7 +7,7 @@ from django.db import models, migrations
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0001_initial'),
|
||||
('core', '0002_load_initial_data'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
Reference in New Issue
Block a user