36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
# Generated by Django 4.1.10 on 2024-03-18 13:55
|
|
import uuid
|
|
|
|
from django.db import migrations, models
|
|
|
|
from common.constants.permission_constants import RoleConstants
|
|
from users.models import password_encrypt
|
|
|
|
|
|
def insert_default_data(apps, schema_editor):
|
|
UserModel = apps.get_model('users', 'User')
|
|
UserModel.objects.create(id='f0dd8f71-e4ee-11ee-8c84-a8a1595801ab', email='', username='admin', nick_name="管理员",
|
|
password=password_encrypt('MaxKB@123..'),
|
|
role=RoleConstants.ADMIN.name,
|
|
is_active=True)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('users', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='user',
|
|
name='nick_name',
|
|
field=models.CharField(default='', max_length=150, verbose_name='昵称'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='user',
|
|
name='phone',
|
|
field=models.CharField(default='', max_length=20, verbose_name='电话'),
|
|
),
|
|
migrations.RunPython(insert_default_data)
|
|
]
|