|
|
|
@ -474,8 +474,9 @@ def admin():
|
|
|
|
|
@app.route("/search", methods=["GET"])
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def search():
|
|
|
|
|
term = request.args.get("query").strip()
|
|
|
|
|
term = request.args.get("query")
|
|
|
|
|
if term:
|
|
|
|
|
term=term.strip()
|
|
|
|
|
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()
|
|
|
|
|
return render_template('search.html', searchterm=term, entries=entries)
|
|
|
|
|