for i in range(10): a = docs.models.doc() a.student = random.choice(college.models.student.objects.all()) a.doctype = random.choice(docs.models.doc_type.objects.all()) x = a.doctype.stages() a.stage_count = x.index(random.choice(x)) a.location = x[a.stage_count] a.save() print '......................................', print 'done' print 'Rooms', for i in rooms: a = roombook.models.room() a.name = i a.ac_available = random.choice([True, False]) a.projector_available = random.choice([True, False]) a.save() print '......................................', print 'done' #add a few reservations print 'Reservations', for i in range(20): a = roombook.models.reservation() a.booked_by = random.choice(college.models.userprofile.objects.all()) a.room_booked = random.choice(roombook.models.room.objects.all()) now = timezone.now() a.time_from = datetime.datetime(now.date().year, now.date().month, random.choice(range(1, 21)),
a=docs.models.doc() a.student=random.choice(college.models.student.objects.all()) a.doctype=random.choice(docs.models.doc_type.objects.all()) x=a.doctype.stages() a.stage_count=x.index(random.choice(x)) a.location=x[a.stage_count] a.save() print '......................................', print 'done' print 'Rooms', for i in rooms: a=roombook.models.room() a.name=i a.ac_available=random.choice([True,False]) a.projector_available=random.choice([True,False]) a.save() print '......................................', print 'done' #add a few reservations print 'Reservations', for i in range(20): a=roombook.models.reservation() a.booked_by=random.choice(college.models.userprofile.objects.all()) a.room_booked=random.choice(roombook.models.room.objects.all()) now=timezone.now() a.time_from=datetime.datetime(now.date().year,now.date().month,random.choice(range(1,21)),now.time().hour,now.time().minute,now.time().second,now.time().microsecond,now.tzinfo) now=a.time_from