From 90b533c3a51595711252d8abe05f6ab81d802d84 Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Wed, 19 Jun 2019 14:59:27 -0300 Subject: [PATCH] =?UTF-8?q?Mostra=20op=C3=A7=C3=B5es=20de=20SessaoLegislat?= =?UTF-8?q?iva=20de=20acordo=20com=20a=20Legislatura=20escolhida?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/base/forms.py | 4 +- sapl/parlamentares/urls.py | 6 ++- sapl/parlamentares/views.py | 13 ++++- .../base/RelatorioPresencaSessao_filter.html | 47 +++++++++++++++++++ 4 files changed, 66 insertions(+), 4 deletions(-) diff --git a/sapl/base/forms.py b/sapl/base/forms.py index f6cdf121d..719c9b1ac 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -879,8 +879,8 @@ class RelatorioPresencaSessaoFilterSet(django_filters.FilterSet): self.form.fields['data_inicio'].required = True row1 = to_row([('data_inicio', 12)]) - row2 = to_row([('sessao_legislativa', 6), - ('legislatura', 6)]) + row2 = to_row([('legislatura', 6), + ('sessao_legislativa', 6)]) self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' diff --git a/sapl/parlamentares/urls.py b/sapl/parlamentares/urls.py index 4c1434333..6e175bafe 100644 --- a/sapl/parlamentares/urls.py +++ b/sapl/parlamentares/urls.py @@ -19,7 +19,8 @@ from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud, parlamentares_frente_selected, remove_parlamentar_composicao, parlamentares_filiados, BlocoCrud, - PesquisarParlamentarView, VincularParlamentarView) + PesquisarParlamentarView, VincularParlamentarView, + get_sessoes_legislatura) from .apps import AppConfig @@ -90,5 +91,8 @@ urlpatterns = [ url(r'^mesa-diretora/remove-parlamentar-composicao/$', remove_parlamentar_composicao, name='remove_parlamentar_composicao'), + + url(r'^parlamentar/get-sessoes-legislatura/$', + get_sessoes_legislatura, name='get_sessoes_legislatura'), ] diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index 874f53385..c81ed46bb 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -1176,4 +1176,15 @@ class BlocoCrud(CrudAux): form_class = BlocoForm def get_success_url(self): - return reverse('sapl.parlamentares:bloco_list') \ No newline at end of file + return reverse('sapl.parlamentares:bloco_list') + + +def get_sessoes_legislatura(request): + + legislatura_id = request.GET['legislatura'] + + json_response = {'sessoes_legislativas': []} + for s in SessaoLegislativa.objects.filter(legislatura_id=legislatura_id): + json_response['sessoes_legislativas'].append( (s.id, str(s)) ) + + return JsonResponse(json_response) \ No newline at end of file diff --git a/sapl/templates/base/RelatorioPresencaSessao_filter.html b/sapl/templates/base/RelatorioPresencaSessao_filter.html index aee028a51..c8881e144 100644 --- a/sapl/templates/base/RelatorioPresencaSessao_filter.html +++ b/sapl/templates/base/RelatorioPresencaSessao_filter.html @@ -53,3 +53,50 @@ {% endif %} {% endblock base_content %} + +{% block extra_js %} + + + +{% endblock %}