This commit is contained in:
2025-03-03 10:23:10 +08:00
parent f3b0d0dce0
commit 80db592723
3 changed files with 31 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
venv
.venv
**/__pycache__
db.sqlite3
.env

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.1.6 on 2025-03-03 02:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='role',
field=models.CharField(choices=[('super', '超级管理员'), ('admin', '管理员'), ('normal', '普通')], default='normal', max_length=20),
),
]

View File

@@ -1,7 +1,17 @@
from django.db import models
# Create your models here.
from django.contrib.auth.models import AbstractUser
class RoleChoices(models.TextChoices):
SUPER = "sup er", "超级管理员"
ADMIN = "admin", "管理员"
NORMAL = "normal", "普通"
class User(AbstractUser):
pass
role = models.CharField(
max_length=20,
choices=RoleChoices.choices,
default=RoleChoices.NORMAL,
)