taskapp/management/commands/seed_db.py
changeset 183 c088c79a225c
parent 139 56203661002a
child 218 59107ce0a618
equal deleted inserted replaced
182:1b4253350a3c 183:c088c79a225c
     6 
     6 
     7 from pytask.taskapp.events import task as taskEvents
     7 from pytask.taskapp.events import task as taskEvents
     8 from pytask.taskapp.events import user as userEvents
     8 from pytask.taskapp.events import user as userEvents
     9 
     9 
    10 from pytask.taskapp.utilities.request import create_request
    10 from pytask.taskapp.utilities.request import create_request
       
    11 from pytask.taskapp.utilities.notification import create_notification
    11 
    12 
    12 
    13 
    13 def seed_db():
    14 def seed_db():
    14     """ a method to seed the database with random data """
    15     """ a method to seed the database with random data """
    15     
    16     
    23         email = username+'@example.com'
    24         email = username+'@example.com'
    24         password = '123456'
    25         password = '123456'
    25         dob = datetime.now()
    26         dob = datetime.now()
    26         gender = "M"
    27         gender = "M"
    27         user = userEvents.createUser(username,email,password,dob,gender)
    28         user = userEvents.createUser(username,email,password,dob,gender)
       
    29         create_notification("NU", user)
    28 
    30 
    29         if i%4==0:
    31         if i%4==0:
    30             create_request(defaultMentor, "MG", user)
    32             create_request(defaultMentor, "MG", user)
    31         elif i%3==0:
    33         elif i%3==0:
    32             create_request(defaultMentor, "DV", user)
    34             create_request(defaultMentor, "DV", user)