endpoint for listing locations

master
Marek Baczynski 6 years ago
parent 7d5d5bb3b4
commit dadab62e9e

@ -47,6 +47,16 @@ def serveImage(img):
def index(): def index():
return render_template('partsearch.html') return render_template('partsearch.html')
@app.route('/parts/getlocations/')
def get_locations():
s = 'select id, map from locations'
r = db_engine.execute(text(s))
l = {}
for row in r:
l[row[0]]=row[1]
r.close()
return json.dumps(l)
@app.route('/parts/getpartinfo/<partID>') @app.route('/parts/getpartinfo/<partID>')
def get_part_info(partID): def get_part_info(partID):
s = 'select * from parts as p inner join locations as l on p.location_id=l.id where p.id = :id;' s = 'select * from parts as p inner join locations as l on p.location_id=l.id where p.id = :id;'

Loading…
Cancel
Save