This commit is contained in:
xuyue committed 2025-04-27 19:06:51 +08:00
1 parent cdf83f4d07
commit 3151bf50c2
1 file changed
+4 -3
+4 -3
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)