Ejemplo n.º 1
0
def add_question():
    if request.method == 'GET':
        return render_template('add.html', question={}, action='Add')
    elif request.method == 'POST':
        data = request.form.to_dict(flat=True)
        questions.save_question(data)
        return redirect('/', code=302)
    else:
        return "Method not supported for /questions/add"
Ejemplo n.º 2
0
def add_question():
    if request.method == 'GET':
        return render_template('add.html', question={}, action='Add')
    elif request.method == 'POST':
        data = request.form.to_dict(flat=True)
        # Gets the image file input
        image_file = request.files.get('image')
        questions.save_question(data, image_file)
        return redirect('/', code=302)
    else:
        return "Method not supported for /questions/add"