# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.conf import settings
from django.http.response import HttpResponseRedirect
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.conf import settings
from django.http.response import HttpResponseRedirect
from django.views.decorators import cache
from django.http import HttpResponse, JsonResponse
from django.views.decorators import cache
from django.http import HttpResponse, JsonResponse
- return render_to_response(
- 'catalogue/search_too_short.html', {'prefix': query},
- context_instance=RequestContext(request))
+ return render(
+ request, 'catalogue/search_too_short.html',
+ {'prefix': query})
- return render_to_response(
- 'catalogue/search_too_long.html', {'prefix': query}, context_instance=RequestContext(request))
+ return render(
+ request, 'catalogue/search_too_long.html',
+ {'prefix': query})
query = prepare_query(query)
pd_authors = search_pd_authors(query)
books = search_books(query)
pictures = search_pictures(query)
query = prepare_query(query)
pd_authors = search_pd_authors(query)
books = search_books(query)
pictures = search_pictures(query)
if not (books or pictures or pd_authors):
form = PublishingSuggestForm(initial={"books": query + ", "})
if not (books or pictures or pd_authors):
form = PublishingSuggestForm(initial={"books": query + ", "})
'catalogue/search_no_hits.html',
{
'form': form,
'did_you_mean': suggestion
'catalogue/search_no_hits.html',
{
'form': form,
'did_you_mean': suggestion
if not (books or pictures) and len(pd_authors) == 1:
return HttpResponseRedirect(pd_authors[0].get_absolute_url())
if not (books or pictures) and len(pd_authors) == 1:
return HttpResponseRedirect(pd_authors[0].get_absolute_url())
'catalogue/search_multiple_hits.html',
{
'pd_authors': pd_authors,
'books': books,
'pictures': pictures,
'did_you_mean': suggestion
'catalogue/search_multiple_hits.html',
{
'pd_authors': pd_authors,
'books': books,
'pictures': pictures,
'did_you_mean': suggestion