Two different user search mode

master
Davide Bongiovanni 6 years ago
parent e3bfe39695
commit 7cf3580844

@ -152,8 +152,12 @@ def meal_planner():
@app.route('/searchusers') @app.route('/searchusers')
def search_users(): def search_users():
q = request.args.get('q') q = request.args.get('q')
s = request.args.get('s')
query = 'select username from users where id>0 and username like :q;' query = 'select username from users where id>0 and username like :q;'
if s == '1':
r = db_engine.execute(text(query), q=(q+'%')) r = db_engine.execute(text(query), q=(q+'%'))
else:
r = db_engine.execute(text(query), q=q)
result = [] result = []
for row in r: for row in r:
result.append(list(row)[0]) result.append(list(row)[0])

Loading…
Cancel
Save