Repository: interlegis/sapl

Issue:
Criar pesquisa da pauta de sessão
#428



Discussion:

Resolving patch:
diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py
--- a/sapl/sessao/forms.py
+++ b/sapl/sessao/forms.py
@@ -173,6 +173,7 @@ class SessaoPlenariaFilterSet(django_filters.FilterSet):
     data_inicio__day = django_filters.ChoiceFilter(required=False,
                                                    label=u'Dia',
                                                    choices=DIA_CHOICES)
+    titulo = _('Pesquisa de Sessão Plenária')
 
     class Meta:
         model = SessaoPlenaria
@@ -190,7 +191,7 @@ def __init__(self, *args, **kwargs):
         self.form.helper = FormHelper()
         self.form.helper.form_method = 'GET'
         self.form.helper.layout = Layout(
-            Fieldset(_('Pesquisa de Sessao Plenária'),
+            Fieldset(self.titulo,
                      row1,
                      form_actions(save_label='Pesquisar'))
         )
@@ -291,3 +292,7 @@ def __init__(self, *args, **kwargs):
     class Meta:
         model = OradorExpediente
         exclude = ['sessao_plenaria']
+
+
+class PautaSessaoFilterSet(SessaoPlenariaFilterSet):
+    titulo = _('Pesquisa de Pauta de Sessão')
diff --git a/sapl/sessao/urls.py b/sapl/sessao/urls.py
--- a/sapl/sessao/urls.py
+++ b/sapl/sessao/urls.py
@@ -8,6 +8,7 @@
                                OradorExpedienteCrud, PainelView,
                                PautaExpedienteDetail, PautaOrdemDetail,
                                PautaSessaoDetailView, PautaSessaoListView,
+                               PesquisarPautaSessaoView,
                                PesquisarSessaoPlenariaView,
                                PresencaOrdemDiaView, PresencaView, ResumoView,
                                SessaoCrud, SessaoPlenariaView,
@@ -75,6 +76,8 @@
     # PAUTA SESSÃO
     url(r'^pauta-sessao$',
         PautaSessaoListView.as_view(), name='list_pauta_sessao'),
+    url(r'^pauta-sessao/pesquisar-pauta$',
+        PesquisarPautaSessaoView.as_view(), name='pesquisar_pauta'),
     url(r'^pauta-sessao/(?P<pk>\d+)$',
         PautaSessaoDetailView.as_view(), name='pauta_sessao_detail'),
     url(r'^pauta-sessao/(?P<pk>\d+)/expediente/$',
diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py
--- a/sapl/sessao/views.py
+++ b/sapl/sessao/views.py
@@ -6,7 +6,7 @@
 from django.core.exceptions import ObjectDoesNotExist, ValidationError
 from django.core.urlresolvers import reverse
 from django.forms.utils import ErrorList
-from django.http import HttpResponse, JsonResponse
+from django.http import JsonResponse
 from django.http.response import HttpResponseRedirect
 from django.utils.datastructures import MultiValueDictKeyError
 from django.utils.html import strip_tags
@@ -32,8 +32,9 @@
 from .forms import (AdicionarVariasMateriasFilterSet, BancadaForm,
                     ExpedienteForm, ExpedienteMateriaForm, ListMateriaForm,
                     MesaForm, OradorExpedienteForm, OradorForm, OrdemDiaForm,
-                    PresencaForm, SessaoPlenariaFilterSet, VotacaoEditForm,
-                    VotacaoForm, VotacaoNominalForm)
+                    PautaSessaoFilterSet, PresencaForm,
+                    SessaoPlenariaFilterSet, VotacaoEditForm, VotacaoForm,
+                    VotacaoNominalForm)
 from .models import (Bancada, Bloco, CargoBancada, CargoMesa,
                      ExpedienteMateria, ExpedienteSessao, IntegranteMesa,
                      MateriaLegislativa, Orador, OradorExpediente, OrdemDia,
@@ -2103,6 +2104,11 @@ def get(self, request, *args, **kwargs):
         return self.render_to_response(context)
 
 
+class PesquisarPautaSessaoView(PesquisarSessaoPlenariaView):
+    filterset_class = PautaSessaoFilterSet
+    template_name = 'sessao/pauta_sessao_filter.html'
+
+
 def filtra_tramitacao_ordem_dia():
         lista = pega_ultima_tramitacao()
         return Tramitacao.objects.filter(


Test patch: