diff --git a/sapl/base/forms.py b/sapl/base/forms.py index b6d6c6c6d..e8242dc43 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -39,7 +39,7 @@ from sapl.utils import (autor_label, autor_modal, ChoiceWithoutValidationField, choice_anos_com_normas, choice_anos_com_materias, FilterOverridesMetaMixin, FileFieldCheckMixin, ImageThumbnailFileInput, qs_override_django_filter, - RANGE_ANOS, YES_NO_CHOICES, + RANGE_ANOS, YES_NO_CHOICES, choice_tipos_normas, GoogleRecapthaMixin, parlamentares_ativos) from .models import AppConfig, CasaLegislativa @@ -880,6 +880,11 @@ class RelatorioNormasMesFilterSet(django_filters.FilterSet): label='Ano da Norma', choices=choice_anos_com_normas, initial=ultimo_ano_com_norma) + + tipo = django_filters.ChoiceFilter(required=False, + label='Tipo Norma', + choices=choice_tipos_normas, + initial=0) class Meta: model = NormaJuridica @@ -892,7 +897,7 @@ class RelatorioNormasMesFilterSet(django_filters.FilterSet): self.filters['ano'].label = 'Ano' self.form.fields['ano'].required = True - row1 = to_row([('ano', 12)]) + row1 = to_row([('ano', 6), ('tipo', 6)]) buttons = FormActions( *[ @@ -971,6 +976,11 @@ class RelatorioNormasVigenciaFilterSet(django_filters.FilterSet): choices=choice_anos_com_normas, initial=ultimo_ano_com_norma) + tipo = django_filters.ChoiceFilter(required=False, + label='Tipo Norma', + choices=choice_tipos_normas, + initial=0) + vigencia = forms.ChoiceField( label=_('Vigência'), choices=[(True, "Vigente"), (False, "Não vigente")], @@ -986,7 +996,7 @@ class RelatorioNormasVigenciaFilterSet(django_filters.FilterSet): self.form.fields['ano'].required = True self.form.fields['vigencia'] = self.vigencia - row1 = to_row([('ano', 12)]) + row1 = to_row([('ano', 6), ('tipo', 6)]) row2 = to_row([('vigencia', 12)]) buttons = FormActions( diff --git a/sapl/utils.py b/sapl/utils.py index 53b76810a..c00dc0716 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -494,6 +494,12 @@ def choice_anos_com_normas(): return choice_anos(NormaJuridica) +def choice_tipos_normas(): + from sapl.norma.models import TipoNormaJuridica + return [(id, descricao) for (id, descricao) in + TipoNormaJuridica.objects.all().values_list('id', 'descricao')] + + def choice_anos_com_protocolo(): from sapl.protocoloadm.models import Protocolo return choice_anos(Protocolo)