예제 #1
0
def add_more_assignments(assignments=20):
    for i in xrange(0, assignments):
        time_offset = datetime.timedelta(minutes=i * 2)
        now = datetime.datetime.utcnow().replace(tzinfo=utc)
        fake_now = now + time_offset

        hw_assignment = HomeworkAssignment(school_class=SchoolClass.get(id=1),
                                           poster=auth.User.get(id=1),
                                           date_posted=fake_now,
                                           date_due=fake_now + datetime.timedelta(days=1),
                                           description="Lorum ipsum dolor python; ruby c lua javascript cubone pikachu charmander bicycle races are coming your way! When u were young u were the King of Carrot Flowers. :)",
                                           thumbnail=os.path.join(app.config['MEDIA_ROOT'], 't1.jpg'))
        hw_assignment.save()