Пример #1
0
def create_asana():
    data = json.loads(request.data)
    try:
        asana = Asana.create_asana(**data)
    except ValueError as e:
        flash(e.message, 'danger')
        return json.dumps({'message': e.message}), 400, {'Content-Type': 'application/json'}
    return json.dumps(asana), 200, {'Content-Type': 'application/json'}
Пример #2
0
def get_asanas():
    if request.is_xhr:
        asanas = Asana.get_asanas()
        return json.dumps(asanas), 200, {'Content-Type': 'application/json'}
    g.nav_view = 'asana'
    return render_template('edit_asanas.html')
Пример #3
0
def delete_asana(uuid):
    Asana.delete_asana(uuid)
    return json.dumps({'message': 'Your asana was successfully deleted.'}), 200, {'Content-Type': 'application/json'}
Пример #4
0
def edit_asana(uuid):
    asana = Asana.update_asana(uuid, **request.form)
    return json.dumps(asana), 200, {'Content-Type': 'application/json'}