Example #1
0
def user_new_class():
    school_class = SchoolClass(title=request.form['title'],
                               school=School.get(id=request.form['school']))
    school_class.save()

    resp = make_response()
    resp.status_code = 200
    return resp
Example #2
0
def user_add_class():
    student_class = StudentClass(student=auth.get_logged_in_user(),
                                 school_class=SchoolClass.get(id=request.form['school_class']))
    student_class.save()

    resp = make_response()
    resp.status_code = 200
    return resp
Example #3
0
def hw_new_assignment():
    # this probably isn't going to work: you should think it out before actually testing this
    # new_assignment = str([a for a in HomeworkAssignment.select()][-1].id + 1) + '.jpg'
    # with open(os.path.join(app.config['MEDIA_ROOT'], new_assignment), 'w') as f:
        # f.write(request.form['b64_photo'])

    hw = HomeworkAssignment(school_class=SchoolClass.get(id=request.form['class']),
                            poster=auth.get_logged_in_user())
    if request.form['b64_photo']:
        hw.save_photo(request.form['b64_photo'])
    hw.save()

    resp = make_response()
    resp.status_code = 200
    return resp