This commit is contained in:
2025-04-27 19:06:51 +08:00
parent cdf83f4d07
commit 3151bf50c2

View File

@@ -29,9 +29,10 @@ class User(AbstractUser):
)
def save(self, *args, **kwargs):
if self.is_superuser:
self.role = RoleChoices.SUPER
super().save(*args, **kwargs)
if self.username:
if self.is_superuser:
self.role = RoleChoices.SUPER
super().save(*args, **kwargs)
def set_password(self, raw_password):
super().set_password(raw_password)