Browse Source

Fixes #3496 otimizado (#3545)

pull/3547/head
Gustavo274 3 years ago
committed by GitHub
parent
commit
bb1cf5acb5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      sapl/sessao/forms.py

14
sapl/sessao/forms.py

@ -606,7 +606,7 @@ class OradorForm(ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields['parlamentar'].queryset = \ self.fields['parlamentar'].queryset = \
Parlamentar.objects.filter(ativo=True).order_by('nome_parlamentar') Parlamentar.objects.filter(mandato__legislatura__sessaoplenaria=self.initial['id_sessao'], ativo=True).order_by('nome_parlamentar')
def clean(self): def clean(self):
super(OradorForm, self).clean() super(OradorForm, self).clean()
@ -643,12 +643,8 @@ class OradorForm(ModelForm):
class OradorExpedienteForm(ModelForm): class OradorExpedienteForm(ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*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 = \ self.fields['parlamentar'].queryset = \
Parlamentar.objects.filter(mandato__legislatura=legislatura_vigente, Parlamentar.objects.filter(mandato__legislatura__sessaoplenaria=self.initial['id_sessao'], ativo=True).order_by('nome_parlamentar')
ativo=True).order_by('nome_parlamentar')
def clean(self): def clean(self):
super(OradorExpedienteForm, self).clean() super(OradorExpedienteForm, self).clean()
@ -683,12 +679,8 @@ class OradorExpedienteForm(ModelForm):
class OradorOrdemDiaForm(ModelForm): class OradorOrdemDiaForm(ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*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 = \ self.fields['parlamentar'].queryset = \
Parlamentar.objects.filter(mandato__legislatura=legislatura_vigente, Parlamentar.objects.filter(mandato__legislatura__sessaoplenaria=self.initial['id_sessao'], ativo=True).order_by('nome_parlamentar')
ativo=True).order_by('nome_parlamentar')
def clean(self): def clean(self):
super(OradorOrdemDiaForm, self).clean() super(OradorOrdemDiaForm, self).clean()

Loading…
Cancel
Save