|
|
|
@ -387,11 +387,6 @@ def show_books():
|
|
|
|
|
|
|
|
|
|
if request.method == 'POST':
|
|
|
|
|
newmsg = 'searched for: ' + search.search.data
|
|
|
|
|
# message = search.search.data
|
|
|
|
|
# newmessage = Chat(message)
|
|
|
|
|
# db.session.add(newmessage)
|
|
|
|
|
# db.session.commit()
|
|
|
|
|
# Send search to socket chat
|
|
|
|
|
socketio.emit('channel-' + str(1), {
|
|
|
|
|
'username': 'Search form',
|
|
|
|
|
'text': search.search.data,
|
|
|
|
@ -410,7 +405,7 @@ def show_books():
|
|
|
|
|
@app.route('/search/<searchtype>/<viewby>/<query>', methods=['POST', 'GET'])
|
|
|
|
|
def search_results(searchtype, query, viewby):
|
|
|
|
|
search = SearchForm(request.form, search=query)
|
|
|
|
|
random_order=Book.query.order_by(func.random()).limit(14)
|
|
|
|
|
random_order=Book.query.all()
|
|
|
|
|
results=Book.query.filter(Book.title.contains(query)).order_by(Book.title)
|
|
|
|
|
viewby = view[-1]
|
|
|
|
|
|
|
|
|
@ -436,8 +431,9 @@ def search_results(searchtype, query, viewby):
|
|
|
|
|
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_description.contains(query))).order_by(Book.title)
|
|
|
|
|
|
|
|
|
|
if results.count() == 0:
|
|
|
|
|
books = Book.query.filter(Book.file.like('potential.pdf'))
|
|
|
|
|
upload_form = UploadForm(title= query, author='')
|
|
|
|
|
return render_template('red_link.html', form=upload_form, title=query)
|
|
|
|
|
return render_template('red_link.html', form=upload_form, title=query, books=books)
|
|
|
|
|
|
|
|
|
|
count = results.count()
|
|
|
|
|
whole = Book.query.count()
|
|
|
|
|