From 794b759c5635b4088a652759cce753305e7af36a Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Mon, 26 Sep 2016 14:10:19 -0300 Subject: [PATCH] =?UTF-8?q?Cria=20p=C3=A1gina=20de=20pesquisa=20de=20Pauta?= =?UTF-8?q?=20de=20Sess=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Luciano Almeida --- sapl/sessao/forms.py | 7 ++- sapl/sessao/urls.py | 3 ++ sapl/sessao/views.py | 12 +++-- sapl/templates/base.html | 2 +- sapl/templates/index.html | 2 +- .../templates/sessao/pauta_sessao_filter.html | 49 +++++++++++++++++++ 6 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 sapl/templates/sessao/pauta_sessao_filter.html diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index 0a9b7b613..9b867f943 100644 --- 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 @@ class SessaoPlenariaFilterSet(django_filters.FilterSet): 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 @@ class OradorExpedienteForm(ModelForm): 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 index 06b4135cf..e23bb4113 100644 --- a/sapl/sessao/urls.py +++ b/sapl/sessao/urls.py @@ -8,6 +8,7 @@ from sapl.sessao.views import (AdicionarVariasMateriasExpediente, OradorExpedienteCrud, PainelView, PautaExpedienteDetail, PautaOrdemDetail, PautaSessaoDetailView, PautaSessaoListView, + PesquisarPautaSessaoView, PesquisarSessaoPlenariaView, PresencaOrdemDiaView, PresencaView, ResumoView, SessaoCrud, SessaoPlenariaView, @@ -75,6 +76,8 @@ urlpatterns = [ # 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\d+)$', PautaSessaoDetailView.as_view(), name='pauta_sessao_detail'), url(r'^pauta-sessao/(?P\d+)/expediente/$', diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index e9c381192..653e81166 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -6,7 +6,7 @@ from django.contrib.auth.mixins import PermissionRequiredMixin 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 sapl.utils import permissao_tb_aux, permissoes_painel, permissoes_sessao 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 @@ class PesquisarSessaoPlenariaView(FilterView): 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( diff --git a/sapl/templates/base.html b/sapl/templates/base.html index 562ade9c1..0d500716a 100644 --- a/sapl/templates/base.html +++ b/sapl/templates/base.html @@ -81,7 +81,7 @@ {% endif %} - +