From 42b0fee3711ed98743270984dc6cfff6af4d7c73 Mon Sep 17 00:00:00 2001 From: eribeiro Date: Thu, 15 Apr 2021 13:51:42 -0300 Subject: [PATCH] Ajusta autoria norma. --- sapl/norma/forms.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sapl/norma/forms.py b/sapl/norma/forms.py index 812c7750b..d2e074842 100644 --- a/sapl/norma/forms.py +++ b/sapl/norma/forms.py @@ -257,6 +257,9 @@ class AutoriaNormaForm(ModelForm): data_relativa = forms.DateField( widget=forms.HiddenInput(), required=False) + legislatura_anterior = forms.BooleanField(label=_('Legislatura Anterior'), + required=False) + logger = logging.getLogger(__name__) def __init__(self, *args, **kwargs): @@ -265,24 +268,23 @@ class AutoriaNormaForm(ModelForm): row1 = to_row([('tipo_autor', 4), ('autor', 4), ('primeiro_autor', 4)]) - row2 = to_row([(HTML('Incluir parlamentares ' - 'da Legislatura anterior (vĂ¡lido somente para ' - 'autores do tipo parlamentar)'), 12)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Autoria'), row1, 'data_relativa', form_actions(label='Salvar'), - row2)) + to_row([('legislatura_anterior', 12)]))) - if not kwargs['instance']: + if not self.instance: self.fields['autor'].choices = [] + class Meta: model = AutoriaNorma - fields = ['tipo_autor', 'autor', 'primeiro_autor', 'data_relativa'] + fields = ['tipo_autor', 'autor', + 'primeiro_autor', 'data_relativa', + 'legislatura_anterior'] def clean(self): cd = super(AutoriaNormaForm, self).clean()