user manger

This commit is contained in:
曹前明 2022-06-22 16:16:14 +08:00
parent 4d449d85d9
commit 00898ab212
1 changed files with 8 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import enum
from django.db import models
from django.contrib.auth.models import AbstractUser
from apps.utils.models import CommonAModel, CommonBModel, BaseModel
from apps.utils.models import CommonAModel, CommonBModel, BaseModel, SoftDeletableManager, SoftDeletableManagerMixin
class DataFilter(models.IntegerChoices):
@ -111,6 +111,11 @@ class PostRole(BaseModel):
on_delete=models.CASCADE, null=True, blank=True)
from django.contrib.auth.models import UserManager
class SoftDeletableUserManager(SoftDeletableManagerMixin, UserManager):
pass
class User(AbstractUser, CommonBModel):
"""
用户
@ -126,6 +131,8 @@ class User(AbstractUser, CommonBModel):
depts = models.ManyToManyField(Dept, through='system.userpost')
roles = models.ManyToManyField(Role, verbose_name='关联角色')
objs = SoftDeletableUserManager()
class Meta:
verbose_name = '用户信息'
verbose_name_plural = verbose_name