def delete_list(list_id): """ Deletes a list. """ if not List.has_access_to(g.user.netid, list_id): return redirect(url_for('board')) List.delete_list_by_id(list_id) return jsonify({"deleted": True})
def list_(list_id): """ Returns or deletes the list specified by list id. """ if not List.has_access_to(g.user.netid, list_id): return error(Error.NO_ACCESS_TO_LIST) if request.method == 'GET': l = List.get_list_by_id(list_id).to_dict() cards = List.get_cards_by_list_id(list_id) l['cards'] = map(lambda x: x.to_dict(), cards) return ok({"list": l}) if request.method == 'DELETE': List.delete_list_by_id(list_id) return ok({"deleted": True})