taskapp/management/commands/seed_db.py
changeset 132 ca88bf4ad362
parent 121 0c568378a4bc
child 139 56203661002a
--- a/taskapp/management/commands/seed_db.py	Sat Feb 27 17:20:22 2010 +0530
+++ b/taskapp/management/commands/seed_db.py	Sat Feb 27 19:21:15 2010 +0530
@@ -7,6 +7,8 @@
 from pytask.taskapp.events import task as taskEvents
 from pytask.taskapp.events import user as userEvents
 
+from pytask.taskapp.utilities.request import create_request
+
 
 def seed_db():
     """ a method to seed the database with random data """
@@ -15,14 +17,24 @@
     mentor_profile = defaultMentor.get_profile()
     userEvents.updateProfile(mentor_profile, {'rights':"AD"})
     
-    for i in range(1,10):
+    for i in range(1,21):
         
         username = 'user'+str(i)
         email = username+'@example.com'
         password = '123456'
         dob = datetime.now()
         gender = "M"
-        userEvents.createUser(username,email,password,dob,gender)
+        user = userEvents.createUser(username,email,password,dob,gender)
+
+        if i%4==0:
+            create_request(defaultMentor, "MG", user)
+        elif i%3==0:
+            create_request(defaultMentor, "DV", user)
+        elif i%2==0:
+            create_request(defaultMentor, "AD", user)
+        elif i in ["7", "13"]:
+            user.is_active = False
+            user.save()
 
     for i in range(1,21):