1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-11-16 15:07:13 +00:00

Add Typeahead for Author input

This commit is contained in:
Cervinko Cera
2016-03-29 00:09:11 +02:00
parent d979ed89c6
commit cd0aeb2857
5 changed files with 657 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ from werkzeug.security import generate_password_hash, check_password_hash
from functools import wraps
import base64
from sqlalchemy.sql import *
import json
app = (Flask(__name__))
@@ -221,6 +222,14 @@ def get_opds_download_link(book_id, format):
suffix=format
)
return response
@app.route("/get_authors_json", methods = ['GET', 'POST'])
def get_authors_json():
if request.method == "POST":
form = request.form.to_dict()
entries = db.session.execute("select name from authors where name like '%" + form['query'] + "%'")
return json.dumps([dict(r) for r in entries])
@app.route("/", defaults={'page': 1})
@app.route('/page/<int:page>')