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')
def search_users():
q = request.args.get('q')
s = request.args.get('s')
query = 'select username from users where id>0 and username like :q;'
r = db_engine.execute(text(query), q=(q+'%'))
if s == '1':
r = db_engine.execute(text(query), q=(q+'%'))
else:
r = db_engine.execute(text(query), q=q)
result = []
for row in r:
result.append(list(row)[0])

Loading…
Cancel
Save