forked from faxad/activflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
40 lines (30 loc) · 1.01 KB
/
demo.py
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
import os
import django
SETTINGS = 'activflow.settings'
os.environ['DJANGO_SETTINGS_MODULE'] = SETTINGS
def main():
"""Entry Point"""
print ('Setting Up demo...')
django.setup()
os.system('sudo rm db.sqlite3')
os.system('sudo rm -r activflow/core/migrations')
os.system('sudo rm -r activflow/tests/migrations')
os.system('./manage.py makemigrations core tests')
os.system('./manage.py migrate')
print ('Create Superuser...')
os.system('./manage.py createsuperuser --email=demo@activflow.com')
from django.contrib.auth.models import Group, User
submitter = Group.objects.create(name='Submitter')
reviewer = Group.objects.create(name='Reviewer')
john_doe = User.objects.create_user(
'john.doe',
'john@company.com',
'12345')
jane_smith = User.objects.create_user(
'jane.smith',
'jane@company.com',
'12345')
submitter.user_set.add(john_doe)
reviewer.user_set.add(jane_smith)
if __name__ == '__main__':
main()