def get(self): entrees = Entree.objects().to_json() return Response(entrees, mimetype="application/json", status=200)
def delete(self, id): Entree.objects().get(id=id).delete() return '', 200
def put(self, id): body = request.get_json() Entree.objects().get(id=id).update(**body) return '', 200
def get(self, id): entree = Entree.objects().get(id=id).to_json() return Response(entree, mimetype="application/json", status=200)
def get_entree(id): entree = Entree.objects().get(id=id) if entree is None: abort(404, "Entree id {0} doesn't exist.".format(id)) return entree
def index(): entrees = Entree.objects() return render_template('entree/index.html', entrees=entrees)