Skip to content

Commit

Permalink
Conserta listagem de parlamentares
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardoliveira committed Sep 21, 2022
1 parent 0a3e08f commit 7f1daea
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions sapl/sessao/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,16 @@ def __init__(self, *args, **kwargs):
class OradorForm(ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

sessao = SessaoPlenaria.objects.get(id=self.initial['id_sessao'])
self.fields['parlamentar'].queryset = \
Parlamentar.objects.filter(
mandato__legislatura__sessaoplenaria=self.initial['id_sessao'], ativo=True).order_by('nome_parlamentar')
mandato__data_inicio_mandato__isnull=False,
mandato__data_fim_mandato__isnull=False,
mandato__data_inicio_mandato__lte=sessao.data_inicio,
mandato__data_fim_mandato__gte=sessao.data_inicio,
ativo=True
).distinct().order_by('nome_parlamentar')

def clean(self):
super(OradorForm, self).clean()
Expand Down Expand Up @@ -687,7 +694,12 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['parlamentar'].queryset = \
Parlamentar.objects.filter(
mandato__legislatura__sessaoplenaria=self.initial['id_sessao'], ativo=True).order_by('nome_parlamentar')
mandato__data_inicio_mandato__isnull=False,
mandato__data_fim_mandato__isnull=False,
mandato__data_inicio_mandato__lte=sessao.data_inicio,
mandato__data_fim_mandato__gte=sessao.data_inicio,
ativo=True
).distinct().order_by('nome_parlamentar')

def clean(self):
super(OradorExpedienteForm, self).clean()
Expand Down

0 comments on commit 7f1daea

Please sign in to comment.