From d7009ba8e36585136b5737e58c47b17b7d1032c5 Mon Sep 17 00:00:00 2001 From: Czw996 <459749926@qq.com> Date: Thu, 12 May 2022 15:13:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/manage/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/manage/models.py b/apps/manage/models.py index f3fdd8d..5fe9c2f 100644 --- a/apps/manage/models.py +++ b/apps/manage/models.py @@ -1,12 +1,13 @@ from django.contrib.auth.models import AbstractBaseUser, BaseUserManager +from django.contrib.auth.hashers import make_password from extensions.models import * class SuperUser(AbstractBaseUser): class Manager(BaseUserManager): - def create_superuser(self, username, password=None, **extra_fields): - return self._create_user(username, password, **extra_fields) + def create_superuser(self, username, password): + return SuperUser.objects.create(username=username, password=make_password(password)) username = CharField(max_length=32, unique=True, verbose_name='用户名')