Add fix for #58 remove trailing spaces
This commit is contained in:
parent
8a9b4e7fc7
commit
897c1648bb
|
@ -256,7 +256,7 @@ def feed_osd():
|
||||||
@app.route("/feed/search", methods=["GET"])
|
@app.route("/feed/search", methods=["GET"])
|
||||||
@requires_basic_auth_if_no_ano
|
@requires_basic_auth_if_no_ano
|
||||||
def feed_search():
|
def feed_search():
|
||||||
term = request.args.get("query")
|
term = request.args.get("query").strip()
|
||||||
if term:
|
if term:
|
||||||
random = db.session.query(db.Books).order_by(func.random()).limit(config.RANDOM_BOOKS)
|
random = db.session.query(db.Books).order_by(func.random()).limit(config.RANDOM_BOOKS)
|
||||||
entries = db.session.query(db.Books).filter(db.or_(db.Books.tags.any(db.Tags.name.like("%"+term+"%")),db.Books.authors.any(db.Authors.name.like("%"+term+"%")),db.Books.title.like("%"+term+"%"))).all()
|
entries = db.session.query(db.Books).filter(db.or_(db.Books.tags.any(db.Tags.name.like("%"+term+"%")),db.Books.authors.any(db.Authors.name.like("%"+term+"%")),db.Books.title.like("%"+term+"%"))).all()
|
||||||
|
@ -474,7 +474,7 @@ def admin():
|
||||||
@app.route("/search", methods=["GET"])
|
@app.route("/search", methods=["GET"])
|
||||||
@login_required_if_no_ano
|
@login_required_if_no_ano
|
||||||
def search():
|
def search():
|
||||||
term = request.args.get("query")
|
term = request.args.get("query").strip()
|
||||||
if term:
|
if term:
|
||||||
random = db.session.query(db.Books).order_by(func.random()).limit(config.RANDOM_BOOKS)
|
random = db.session.query(db.Books).order_by(func.random()).limit(config.RANDOM_BOOKS)
|
||||||
entries = db.session.query(db.Books).filter(db.or_(db.Books.tags.any(db.Tags.name.like("%"+term+"%")),db.Books.series.any(db.Series.name.like("%"+term+"%")),db.Books.authors.any(db.Authors.name.like("%"+term+"%")),db.Books.title.like("%"+term+"%"))).all()
|
entries = db.session.query(db.Books).filter(db.or_(db.Books.tags.any(db.Tags.name.like("%"+term+"%")),db.Books.series.any(db.Series.name.like("%"+term+"%")),db.Books.authors.any(db.Authors.name.like("%"+term+"%")),db.Books.title.like("%"+term+"%"))).all()
|
||||||
|
@ -489,8 +489,8 @@ def advanced_search():
|
||||||
q = db.session.query(db.Books)
|
q = db.session.query(db.Books)
|
||||||
include_tag_inputs = request.args.getlist('include_tag')
|
include_tag_inputs = request.args.getlist('include_tag')
|
||||||
exclude_tag_inputs = request.args.getlist('exclude_tag')
|
exclude_tag_inputs = request.args.getlist('exclude_tag')
|
||||||
author_name = request.args.get("author_name")
|
author_name = request.args.get("author_name").strip()
|
||||||
book_title = request.args.get("book_title")
|
book_title = request.args.get("book_title").strip()
|
||||||
if include_tag_inputs or exclude_tag_inputs or author_name or book_title:
|
if include_tag_inputs or exclude_tag_inputs or author_name or book_title:
|
||||||
searchterm = []
|
searchterm = []
|
||||||
searchterm.extend((author_name, book_title))
|
searchterm.extend((author_name, book_title))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user