kopia lustrzana https://github.com/wagtail/wagtail
Added backwards compatibility to new search view
rodzic
03019b9640
commit
cc42de0cd4
|
@ -0,0 +1,8 @@
|
|||
from django.conf.urls import patterns, url
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'wagtail.wagtailsearch.views',
|
||||
url(r'^$', 'search', name='wagtailsearch_search'),
|
||||
url(r'^suggest/$', 'search', {'use_json': True}, name='wagtailsearch_suggest'),
|
||||
)
|
|
@ -11,7 +11,7 @@ from wagtail.wagtailsearch.models import Query
|
|||
|
||||
def search(
|
||||
request,
|
||||
template='wagtailsearch/search_results.html',
|
||||
template=None,
|
||||
template_ajax=None,
|
||||
results_per_page=10,
|
||||
use_json=False,
|
||||
|
@ -21,6 +21,21 @@ def search(
|
|||
extra_filters={},
|
||||
path=None,
|
||||
):
|
||||
|
||||
# Get default templates
|
||||
if template is None:
|
||||
if hasattr(settings, 'WAGTAILSEARCH_RESULTS_TEMPLATE'):
|
||||
template = settings.WAGTAILSEARCH_RESULTS_TEMPLATE
|
||||
else:
|
||||
template = 'wagtailsearch/search_results.html'
|
||||
|
||||
if template_ajax is None:
|
||||
if hasattr(settings, 'WAGTAILSEARCH_RESULTS_TEMPLATE_AJAX'):
|
||||
template_ajax = settings.WAGTAILSEARCH_RESULTS_TEMPLATE_AJAX
|
||||
else:
|
||||
template_ajax = template
|
||||
|
||||
# Get query string and page from GET paramters
|
||||
query_string = request.GET.get('q', '')
|
||||
page = request.GET.get('p', 1)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue