From 3713d111a4ab446a6c2eb56c131e868eb7e7bd0c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 18 Jun 2020 19:04:13 +0200 Subject: [PATCH] core: fix integrity error for default user closes #75 --- passbook/core/migrations/0003_default_user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/passbook/core/migrations/0003_default_user.py b/passbook/core/migrations/0003_default_user.py index e1d52f3b4..d236c8f90 100644 --- a/passbook/core/migrations/0003_default_user.py +++ b/passbook/core/migrations/0003_default_user.py @@ -6,10 +6,10 @@ from django.db.backends.base.schema import BaseDatabaseSchemaEditor def create_default_user(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): - # User = apps.get_model("passbook_core", "User") + # We have to use a direct import here, otherwise we get an object manager error from passbook.core.models import User - pbadmin = User.objects.create( + pbadmin, _ = User.objects.get_or_create( username="pbadmin", email="root@localhost", name="passbook Default Admin" ) pbadmin.set_password("pbadmin") # noqa # nosec