diff --git a/combo/apps/search/models.py b/combo/apps/search/models.py index 87a1fbac..fc4aecf2 100644 --- a/combo/apps/search/models.py +++ b/combo/apps/search/models.py @@ -111,12 +111,19 @@ class SearchCell(CellBase): if not cell.is_visible(request.user) or not cell.page.is_visible(request.user): raise PermissionDenied + query = request.GET.get('q') + def render_response(service={}, results={'err': 0, 'data': []}): template_names = ['combo/search-cell-results.html'] if cell.slug: template_names.insert(0, 'combo/cells/%s/search-cell-results.html' % cell.slug) tmpl = template.loader.select_template(template_names) - context = {'cell': cell, 'results': results, 'search_service': service} + context = { + 'cell': cell, + 'results': results, + 'search_service': service, + 'query': query + } return HttpResponse(tmpl.render(context, request), content_type='text/html') for service in cell.search_services: @@ -125,7 +132,6 @@ class SearchCell(CellBase): else: return render_response() - query = request.GET.get('q') if not query: return render_response(service) diff --git a/combo/apps/search/templates/combo/search-cell-results.html b/combo/apps/search/templates/combo/search-cell-results.html index 75e29681..dae4acb7 100644 --- a/combo/apps/search/templates/combo/search-cell-results.html +++ b/combo/apps/search/templates/combo/search-cell-results.html @@ -1,4 +1,5 @@ {% load i18n %} +{% if query %} {% if cell.has_multiple_search_services %}
{{ search_service.label }}
{% endif %} {% if results.data %}