last commit or the night, a feel-good one, now have search by file name and refimg tag, can find ppl :)

This commit is contained in:
2021-01-23 00:48:00 +11:00
parent c0648f0822
commit afc4eda233
2 changed files with 14 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ import time
################################################################################
from settings import Settings
from job import Job, Joblog, NewJob
from person import Person
from person import Person, File_Person_Link
################################################################################
# Class describing File in the database, and via sqlalchemy, connected to the DB as well
@@ -90,6 +90,18 @@ def file_list():
def files():
return render_template("files.html", page_title='View Files', entry_data=Entry.query.all())
################################################################################
# /search -> show thumbnail view of files from import_path(s)
################################################################################
@app.route("/search", methods=["GET","POST"])
def search():
file_data=Entry.query.filter(Entry.name.ilike(f"%{request.form['term']}%")).all()
ai_data=Entry.query.join(File).join(File_Person_Link).filter(File_Person_Link.file_id==File.eid).join(Person).filter(Person.tag.ilike(f"%{request.form['term']}%")).all()
all_entries = file_data + ai_data
return render_template("files.html", page_title='View Files', entry_data=all_entries)
################################################################################
# /files/scannow -> allows us to force a check for new files
################################################################################