feat(search/views.py): search only courses
This commit is contained in:
@@ -2,6 +2,7 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
|
|
||||||
from wagtail.models import Page
|
from wagtail.models import Page
|
||||||
|
from home.models import CoursePage
|
||||||
|
|
||||||
# To enable logging of search queries for use with the "Promoted search results" module
|
# To enable logging of search queries for use with the "Promoted search results" module
|
||||||
# <https://docs.wagtail.org/en/stable/reference/contrib/searchpromotions.html>
|
# <https://docs.wagtail.org/en/stable/reference/contrib/searchpromotions.html>
|
||||||
@@ -20,7 +21,7 @@ def search(request):
|
|||||||
|
|
||||||
# Search
|
# Search
|
||||||
if search_query:
|
if search_query:
|
||||||
search_results = Page.objects.live().search(search_query)
|
search_results = CoursePage.objects.live().search(search_query)
|
||||||
|
|
||||||
# To log this query for use with the "Promoted search results" module:
|
# To log this query for use with the "Promoted search results" module:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user