jetze
This commit is contained in:
parent
a591e34af4
commit
48e8c3e97a
19
firstrun.py
19
firstrun.py
|
|
@ -1,13 +1,28 @@
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from users.models import Profile,Agency
|
from users.models import Profile,Agency
|
||||||
|
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
|
||||||
|
def randomStringwithDigitsAndSymbols(stringLength=10):
|
||||||
|
"""Generate a random string of letters, digits and special characters """
|
||||||
|
|
||||||
|
password_characters = string.ascii_letters + string.digits + string.punctuation
|
||||||
|
return ''.join(random.choice(password_characters) for i in range(stringLength))
|
||||||
|
|
||||||
|
username = "root"
|
||||||
|
password = randomStringwithDigitsAndSymbols(20)
|
||||||
|
print("USERNAME: " + username)
|
||||||
|
print("PASSWORD: " + password)
|
||||||
ag=Agency()
|
ag=Agency()
|
||||||
ag.save()
|
ag.save()
|
||||||
pr=Profile()
|
pr=Profile()
|
||||||
pr.agency=ag
|
pr.agency=ag
|
||||||
try:
|
try:
|
||||||
user=User.objects.create_user('root', 'support@digitale-agentur.com', 'Penis!!!LOL')
|
user=User.objects.create_user(username, 'support@digitale-agentur.com', password)
|
||||||
except:
|
except:
|
||||||
user = User.objects.get(username='root')
|
send_mail
|
||||||
|
user = User.objects.get(username=username)
|
||||||
user.first_name = 'ROOT'
|
user.first_name = 'ROOT'
|
||||||
user.last_name = 'ROOT'
|
user.last_name = 'ROOT'
|
||||||
pr.user=user
|
pr.user=user
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue