From 7bee9ecd9f3221f0f90c9bee8856b7ded7c41e98 Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Wed, 5 Jun 2019 09:09:24 -0300 Subject: [PATCH] =?UTF-8?q?HOT-FIX:=20Parlamentares=20de=20outras=20legisl?= =?UTF-8?q?aturas=20aparecendo=20como=20op=C3=A7=C3=A3o=20de=20Oradores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/sessao/forms.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index c09d2f220..65d89d984 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -672,8 +672,12 @@ class OradorForm(ModelForm): class OradorExpedienteForm(ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + id_sessao = int(self.initial['id_sessao']) + sessao = SessaoPlenaria.objects.get(id=id_sessao) + legislatura_vigente = sessao.legislatura self.fields['parlamentar'].queryset = \ - Parlamentar.objects.filter(ativo=True).order_by('nome_parlamentar') + Parlamentar.objects.filter(mandato__legislatura=legislatura_vigente, + ativo=True).order_by('nome_parlamentar') def clean(self): super(OradorExpedienteForm, self).clean() @@ -703,8 +707,12 @@ class OradorExpedienteForm(ModelForm): class OradorOrdemDiaForm(ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + id_sessao = int(self.initial['id_sessao']) + sessao = SessaoPlenaria.objects.get(id=id_sessao) + legislatura_vigente = sessao.legislatura self.fields['parlamentar'].queryset = \ - Parlamentar.objects.filter(ativo=True).order_by('nome_parlamentar') + Parlamentar.objects.filter(mandato__legislatura=legislatura_vigente, + ativo=True).order_by('nome_parlamentar') def clean(self): super(OradorOrdemDiaForm, self).clean()