kopia lustrzana https://github.com/wagtail/wagtail
Remove search logging from project template #11190
The search view on the project template is still attempting to log queries against the now-removed wagtailsearch.Query model - as of 6.0a0 this is causing an ImportError when running initial migrations on a newly-created project. Since the wagtail.contrib.search_promotions module is optional (and off by default on new projects), I've opted to comment out the query logging code with instructions for developers who wish to re-enable it. # Conflicts: # CHANGELOG.txt # docs/releases/6.0.mdpull/11234/head
rodzic
35d5172df3
commit
21b9881da6
|
@ -5,6 +5,7 @@ Changelog
|
|||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Fix: Add a fallback background for the editing preview iframe for sites without a background (Ian Price)
|
||||
* Fix: Remove search logging from project template so that new projects without the search promotions module will not error (Matt Westcott)
|
||||
* Docs: Fix code example for `{% picture ... as ... %}` template tag (Rezyapkin)
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ depth: 1
|
|||
### Bug fixes
|
||||
|
||||
* Add a fallback background for the editing preview iframe for sites without a background (Ian Price)
|
||||
* Remove search logging from project template so that new projects without the search promotions module will not error (Matt Westcott)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
|
|
@ -2,7 +2,13 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
|
|||
from django.template.response import TemplateResponse
|
||||
|
||||
from wagtail.models import Page
|
||||
from wagtail.search.models import Query
|
||||
|
||||
# To enable logging of search queries for use with the "Promoted search results" module
|
||||
# <https://docs.wagtail.org/en/stable/reference/contrib/searchpromotions.html>
|
||||
# uncomment the following line and the lines indicated in the search function
|
||||
# (after adding wagtail.contrib.search_promotions to INSTALLED_APPS):
|
||||
|
||||
# from wagtail.contrib.search_promotions.models import Query
|
||||
|
||||
|
||||
def search(request):
|
||||
|
@ -12,10 +18,12 @@ def search(request):
|
|||
# Search
|
||||
if search_query:
|
||||
search_results = Page.objects.live().search(search_query)
|
||||
query = Query.get(search_query)
|
||||
|
||||
# Record hit
|
||||
query.add_hit()
|
||||
# To log this query for use with the "Promoted search results" module:
|
||||
|
||||
# query = Query.get(search_query)
|
||||
# query.add_hit()
|
||||
|
||||
else:
|
||||
search_results = Page.objects.none()
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue