Exemplo n.º 1
0
def insert_task():
    if ('description' in request.form and request.form['description'] != ''):
        description = request.form['description']
        if ('urgent' in request.form and request.form['urgent'] == 'on'):
            urgent = 1
        else:
            urgent = 0
        db_interaction.insert_task(description, urgent)

    # back to the home page
    return redirect(url_for('index'))
Exemplo n.º 2
0
def insert_task():
    new_task = request.json

    if (new_task is not None) and ('description' in new_task) and ('priority' in new_task):
        text = new_task['description']
        urgent = new_task['priority']

        # insert in the database
        db_interaction.insert_task(text, urgent)

        return Response(status=201)

    abort(403)
Exemplo n.º 3
0
def insert_task():
    # get the request body
    add_request = request.json

    # check whether a task is present in the request or not
    if (add_request is not None) and ('description' in add_request) and ('urgent' in add_request):
        text = add_request['description']
        urgent = add_request['urgent']

        # insert in the database
        db_interaction.insert_task(text, urgent)

        return Response(status=200)

    # return an error in case of problems
    abort(403)
Exemplo n.º 4
0
def insert_task():
    # get the request body
    add_request = request.json

    # check whether a task is present in the request or not
    if (add_request is not None) and ('description' in add_request) and ('urgent' in add_request):
        text = add_request['description']
        urgent = add_request['urgent']

        # insert in the database
        db_interaction.insert_task(text, urgent)

        return Response(status=201)

    # return an error in case of problems
    abort(403)