34 lines
711 B
Python
34 lines
711 B
Python
from django.contrib.auth.models import User
|
|
from users.models import Profile,Agency
|
|
|
|
import random
|
|
import string
|
|
|
|
password_characters = string.ascii_letters + string.digits + string.punctuation
|
|
|
|
username = "root"
|
|
password = ""
|
|
|
|
i = 0
|
|
while(i < 20):
|
|
password += random.choice(password_characters)
|
|
i += 1
|
|
|
|
print("USERNAME: " + username)
|
|
print("PASSWORD: " + password)
|
|
ag=Agency()
|
|
ag.save()
|
|
pr=Profile()
|
|
pr.agency=ag
|
|
try:
|
|
user=User.objects.create_user(username, 'support@digitale-agentur.com', password)
|
|
except:
|
|
user = User.objects.get(username=username)
|
|
user.first_name = 'ROOT'
|
|
user.last_name = 'ROOT'
|
|
pr.user=user
|
|
pr.save()
|
|
user.profile = pr
|
|
user.is_superuser = True
|
|
user.is_staff = True
|
|
user.save() |