diff --git a/sapl/base/urls.py b/sapl/base/urls.py index 2b4e52d62..f44ba22b3 100644 --- a/sapl/base/urls.py +++ b/sapl/base/urls.py @@ -16,7 +16,8 @@ from .views import (AppConfigCrud, CasaLegislativaCrud, HelpView, RelatorioMateriasPorAnoAutorTipoView, RelatorioMateriasPorAutorView, RelatorioMateriasTramitacaoView, - RelatorioPresencaSessaoView) + RelatorioPresencaSessaoView, + SaplSearchView) app_name = AppConfig.name @@ -100,6 +101,6 @@ urlpatterns = [ name='login'), url(r'^logout/$', views.logout, {'next_page': '/login'}, name='logout'), - url(r'^sistema/search/', include('haystack.urls')), + url(r'^sistema/search/', SaplSearchView(), name='search_view'), ] + recuperar_senha diff --git a/sapl/base/views.py b/sapl/base/views.py index 96b989479..4c86ff515 100644 --- a/sapl/base/views.py +++ b/sapl/base/views.py @@ -14,6 +14,8 @@ from django.utils.translation import ugettext_lazy as _ from django.views.generic.base import TemplateView from django_filters.views import FilterView +from haystack.views import SearchView + from sapl.base.forms import AutorForm, AutorFormForAdmin, TipoAutorForm from sapl.base.models import Autor, TipoAutor from sapl.crud.base import CrudAux @@ -454,3 +456,22 @@ class AppConfigCrud(CrudAux): def get(self, request, *args, **kwargs): return HttpResponseRedirect(reverse('sapl.base:appconfig_create')) + + +class SaplSearchView(SearchView): + results_per_page = 10 + + def get_context(self): + context = super(SaplSearchView, self).get_context() + + if 'models' in self.request.GET: + models = self.request.GET.getlist('models') + else: + models = [] + + context['models'] = '' + + for m in models: + context['models'] = context['models'] + '&models=' + m + + return context \ No newline at end of file diff --git a/sapl/templates/search/search.html b/sapl/templates/search/search.html index 4efae2cc5..80365f5b2 100644 --- a/sapl/templates/search/search.html +++ b/sapl/templates/search/search.html @@ -93,9 +93,13 @@ {% if page.has_previous or page.has_next %}
- {% if page.has_previous %}{% endif %}« Previous{% if page.has_previous %}{% endif %} + {% if page.has_previous %} + + {% endif %}« Previous{% if page.has_previous %}{% endif %} | - {% if page.has_next %}{% endif %}Next »{% if page.has_next %}{% endif %} + {% if page.has_next %} + + {% endif %}Next »{% if page.has_next %}{% endif %}
{% endif %} {% else %}