From 48008c820dee41b90e9815e87a6a7d3a46d55ba0 Mon Sep 17 00:00:00 2001 From: vkcz <69770865+vkcz@users.noreply.github.com> Date: Sun, 3 Apr 2022 00:08:56 -0400 Subject: [PATCH 1/2] search by notes add query option `sn` to search in notes instead of content --- qdb/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qdb/views.py b/qdb/views.py index e894cde..821f7ca 100644 --- a/qdb/views.py +++ b/qdb/views.py @@ -195,7 +195,8 @@ def search(request): template = loader.get_template('qdb/search.html') query = request.GET.get('q', '') tag = request.GET.get('tag', '') - quote_list = quotes.filter(content__contains=query) + sn = request.GET.get('sn', '') + quote_list = quotes.filter(notes__contains=query) if sn else quotes.filter(content__contains=query) if tag: quote_list = quote_list.filter(tags__name__in=[tag]) quote_list = quote_list.order_by('-timestamp') return get_quotes('Search Quotes', quote_list, request, query=query, tag=tag) From 75200bc45484434452a6b2947f02e908e308b726 Mon Sep 17 00:00:00 2001 From: vkcz <69770865+vkcz@users.noreply.github.com> Date: Sun, 3 Apr 2022 00:15:37 -0400 Subject: [PATCH 2/2] checkbox to search in notes --- qdb/templates/qdb/search.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qdb/templates/qdb/search.html b/qdb/templates/qdb/search.html index 3ebc125..abf46c9 100644 --- a/qdb/templates/qdb/search.html +++ b/qdb/templates/qdb/search.html @@ -9,6 +9,7 @@ @@ -36,4 +37,4 @@ $('.tag-input').empty().trigger('change') } -{% endblock %} \ No newline at end of file +{% endblock %}