aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/views/views.py')
-rw-r--r--src/web/views/views.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/web/views/views.py b/src/web/views/views.py
index b4833233..90836af1 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -234,6 +234,7 @@ from flask import jsonify
@app.route('/home2')
+@login_required
def new_home():
return render_template('home2.html')
@@ -265,6 +266,18 @@ def get_menu():
def _get_filters(in_dict):
filters = {}
+ query = in_dict.get('query')
+ if query:
+ search_title = in_dict.get('search_title') == 'true'
+ search_content = in_dict.get('search_content') == 'true'
+ if search_title:
+ filters['title__ilike'] = "%%%s%%" % query
+ if search_content:
+ filters['content__ilike'] = "%%%s%%" % query
+ if len(filters) == 0:
+ filters['title__ilike'] = "%%%s%%" % query
+ if len(filters) > 1:
+ filters = {"__or__": filters}
if in_dict.get('filter') == 'unread':
filters['readed'] = False
elif in_dict.get('filter') == 'liked':
bgstack15