Ejemplo n.º 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()
Ejemplo n.º 2
0
    student_class.save()


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()


if __name__ == '__main__':
    auth.User.create_table(fail_silently=True)
    School.create_table(fail_silently=True)
    SchoolClass.create_table(fail_silently=True)
    HomeworkAssignment.create_table(fail_silently=True)
    StudentClass.create_table(fail_silently=True)

    init_school()
    init_admin()
    init_school_class()
    init_student_class()
    add_more_assignments()