mirror of
https://github.com/YunoHost-Apps/django-for-runners_ynh.git
synced 2024-09-03 18:26:16 +02:00
setup existing user
This commit is contained in:
parent
d4269c42af
commit
32a6ab35fa
1 changed files with 9 additions and 6 deletions
|
@ -24,12 +24,15 @@ def main():
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
super_user = User.objects.filter(username=username).first()
|
user = User.objects.filter(username=username).first()
|
||||||
if super_user:
|
if user:
|
||||||
print('Update existing super user and set his password.', file=sys.stderr)
|
print('Update existing user and set his password.', file=sys.stderr)
|
||||||
super_user.set_password(password)
|
user.is_active = True
|
||||||
super_user.email=email
|
user.is_staff = True
|
||||||
super_user.save()
|
user.is_superuser = True
|
||||||
|
user.set_password(password)
|
||||||
|
user.email = email
|
||||||
|
user.save()
|
||||||
else:
|
else:
|
||||||
print('Create new super user', file=sys.stderr)
|
print('Create new super user', file=sys.stderr)
|
||||||
User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
|
|
Loading…
Reference in a new issue