Browse Source

Fix #1302 restringir tipo pesq textual (#1313)

* Conserta anulação de votação

* Conserta bug e melhora visual do Painel

* Fix #1275 Fix #1293

* Fix #1299

* Fix #1303

* Inicia resolução

* Fix #1302
pull/1314/head
Eduardo Calil 8 years ago
committed by Edward
parent
commit
2b7e537643
  1. 5
      sapl/base/urls.py
  2. 21
      sapl/base/views.py
  3. 8
      sapl/templates/search/search.html

5
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

21
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

8
sapl/templates/search/search.html

@ -93,9 +93,13 @@
{% if page.has_previous or page.has_next %}
<div>
{% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
{% if page.has_previous %}
<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}{{ models }}">
{% endif %}&laquo; Previous{% if page.has_previous %}</a>{% endif %}
|
{% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
{% if page.has_next %}
<a href="?q={{ query }}&amp;page={{ page.next_page_number }}{{ models }}">
{% endif %}Next &raquo;{% if page.has_next %}</a>{% endif %}
</div>
{% endif %}
{% else %}

Loading…
Cancel
Save