예제 #1
0
def view_json(id):
    note = get_or_404(LogEntry, entry_type='log', id=id)

    if request.method in ['PATCH', 'PUT']:
        note.entry.update(**entry_from_json('log', request.json))
        note.add_tags(request.json.get('tags', []))
        note.reload()

    return jsonify(note.to_json())
예제 #2
0
def objective_json(id):
    objective = get_objective_or_404(id=id)

    if request.method in ['PATCH', 'PUT']:
        objective.entry.update(**entry_from_json('objective', request.json))
        objective.add_tags(request.json.get('tags', []))
        objective.reload()

    return jsonify(objective.to_json())