-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopulate_user.py
More file actions
46 lines (28 loc) · 927 Bytes
/
populate_user.py
File metadata and controls
46 lines (28 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE','cs35_site_project.settings')
import django
django.setup()
from chemapp.models import *
import random
def print_bar():
print("-------------------")
def create_user(username,password,permission):
print("creating User: ")
print("username: " + username)
print("password: "+password)
user_object = User.objects.create_user(username, password=password)
if (permission == "superuser"):
user_object.is_superuser = True
user_object.is_staff = True
print("permission: " + permission)
else:
print("permission: " + permission)
user_object.save()
print_bar()
if __name__ == "__main__":
print_bar()
#temparary admin account
create_user("admin","admin","superuser")
#temporary staff acounts no permissions
create_user("staff1","staff1","")
create_user("staff2","staff2","")