mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
create admin user while migrating
This commit is contained in:
parent
6aa6ea0817
commit
f37d6601e1
1 changed files with 21 additions and 0 deletions
21
accounts/migrations/0002_addAdmin.py
Normal file
21
accounts/migrations/0002_addAdmin.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Generated by Django 2.2.10 on 2020-01-28 07:01
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def add_useradmin(apps, schema_editor):
|
||||||
|
from django.utils import timezone
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
User.objects.create_superuser('admin', None, 'admin', last_login=timezone.now())
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('accounts', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(add_useradmin),
|
||||||
|
]
|
Loading…
Reference in a new issue