Example #1
0
 def get(self):
     entrees = Entree.objects().to_json()
     return Response(entrees, mimetype="application/json", status=200)
Example #2
0
 def delete(self, id):
     Entree.objects().get(id=id).delete()
     return '', 200
Example #3
0
 def put(self, id):
     body = request.get_json()
     Entree.objects().get(id=id).update(**body)
     return '', 200
Example #4
0
 def get(self, id):
     entree = Entree.objects().get(id=id).to_json()
     return Response(entree, mimetype="application/json", status=200)
Example #5
0
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
Example #6
0
def index():
    entrees = Entree.objects()
    return render_template('entree/index.html', entrees=entrees)