mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Fixed superuser being created as inactive user
This commit is contained in:
parent
5f157d83b9
commit
a67d8ae106
1 changed files with 7 additions and 2 deletions
|
@ -73,5 +73,10 @@ def create_superuser(sender, **kwargs):
|
|||
password = os.getenv('DJANGO_ADMIN_PASSWORD')
|
||||
|
||||
if not User.objects.filter(username=username).exists():
|
||||
User.objects.create_superuser(
|
||||
username, email, password)
|
||||
# Create the superuser with is_active set to False
|
||||
superuser = User.objects.create_superuser(
|
||||
username=username, email=email, password=password)
|
||||
|
||||
# Activate the superuser
|
||||
superuser.is_active = True
|
||||
superuser.save()
|
||||
|
|
Loading…
Reference in a new issue