mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
Fix from tests advanced search for custom columns
This commit is contained in:
parent
96d6018ecc
commit
244db8d894
@ -1135,13 +1135,16 @@ def advanced_search():
|
|||||||
# search custom culumns
|
# search custom culumns
|
||||||
for c in cc:
|
for c in cc:
|
||||||
custom_query = request.args.get('custom_column_' + str(c.id))
|
custom_query = request.args.get('custom_column_' + str(c.id))
|
||||||
if custom_query:
|
if custom_query != '' and custom_query is not None:
|
||||||
if c.datatype == 'bool':
|
if c.datatype == 'bool':
|
||||||
q = q.filter(getattr(db.Books, 'custom_column_' + str(c.id)).any(
|
q = q.filter(getattr(db.Books, 'custom_column_' + str(c.id)).any(
|
||||||
db.cc_classes[c.id].value == (custom_query == "True")))
|
db.cc_classes[c.id].value == (custom_query == "True")))
|
||||||
elif c.datatype == 'int':
|
elif c.datatype == 'int' or c.datatype == 'float':
|
||||||
q = q.filter(getattr(db.Books, 'custom_column_' + str(c.id)).any(
|
q = q.filter(getattr(db.Books, 'custom_column_' + str(c.id)).any(
|
||||||
db.cc_classes[c.id].value == custom_query))
|
db.cc_classes[c.id].value == custom_query))
|
||||||
|
elif c.datatype == 'rating':
|
||||||
|
q = q.filter(getattr(db.Books, 'custom_column_' + str(c.id)).any(
|
||||||
|
db.cc_classes[c.id].value == int(custom_query) * 2))
|
||||||
else:
|
else:
|
||||||
q = q.filter(getattr(db.Books, 'custom_column_' + str(c.id)).any(
|
q = q.filter(getattr(db.Books, 'custom_column_' + str(c.id)).any(
|
||||||
func.lower(db.cc_classes[c.id].value).ilike("%" + custom_query + "%")))
|
func.lower(db.cc_classes[c.id].value).ilike("%" + custom_query + "%")))
|
||||||
|
Loading…
Reference in New Issue
Block a user