Browse Source

Fix #838

pull/856/head
Eduardo Edson Batista Cordeiro Alves 8 years ago
parent
commit
ccc030c7df
  1. 30
      sapl/materia/forms.py

30
sapl/materia/forms.py

@ -1,13 +1,14 @@
import os
from datetime import date, datetime from datetime import date, datetime
from itertools import chain from itertools import chain
import os
import django_filters
from crispy_forms.bootstrap import (Alert, FormActions, InlineCheckboxes, from crispy_forms.bootstrap import (Alert, FormActions, InlineCheckboxes,
InlineRadios) InlineRadios)
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import (HTML, Button, Column, Field, Fieldset, Layout, from crispy_forms.layout import (HTML, Button, Column, Div, Field, Fieldset,
Submit, Div) Layout, Submit)
from django import forms from django import forms
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.core.exceptions import ObjectDoesNotExist, ValidationError
@ -22,17 +23,18 @@ from django.utils.encoding import force_text
from django.utils.html import format_html from django.utils.html import format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import django_filters
import sapl
from sapl.base.models import Autor from sapl.base.models import Autor
from sapl.comissoes.models import Comissao from sapl.comissoes.models import Comissao
from sapl.compilacao.models import STATUS_TA_PRIVATE,\ from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
STATUS_TA_IMMUTABLE_PUBLIC, TextoArticulado, STATUS_TA_PUBLIC,\ STATUS_TA_PRIVATE, STATUS_TA_PUBLIC,
PerfilEstruturalTextoArticulado PerfilEstruturalTextoArticulado,
TextoArticulado)
from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column, from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions, to_column,
to_row) to_row)
from sapl.materia.models import TipoProposicao, MateriaLegislativa,\ from sapl.materia.models import (MateriaLegislativa, RegimeTramitacao,
RegimeTramitacao, TipoDocumento TipoDocumento, TipoProposicao)
from sapl.norma.models import (LegislacaoCitada, NormaJuridica, from sapl.norma.models import (LegislacaoCitada, NormaJuridica,
TipoNormaJuridica) TipoNormaJuridica)
from sapl.parlamentares.models import Parlamentar from sapl.parlamentares.models import Parlamentar
@ -42,12 +44,10 @@ from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES,
ChoiceWithoutValidationField, ChoiceWithoutValidationField,
MateriaPesquisaOrderingFilter, RangeWidgetOverride, MateriaPesquisaOrderingFilter, RangeWidgetOverride,
autor_label, autor_modal, models_with_gr_for_model) autor_label, autor_modal, models_with_gr_for_model)
import sapl
from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial,
DocumentoAcessorio, Numeracao, DocumentoAcessorio, Numeracao, Proposicao, Relatoria,
Proposicao, Relatoria, TipoMateriaLegislativa, Tramitacao, TipoMateriaLegislativa, Tramitacao, UnidadeTramitacao)
UnidadeTramitacao)
def ANO_CHOICES(): def ANO_CHOICES():
@ -679,7 +679,7 @@ class PrimeiraTramitacaoEmLoteFilterSet(django_filters.FilterSet):
self.filters['tipo'].label = 'Tipo de Matéria' self.filters['tipo'].label = 'Tipo de Matéria'
self.filters['data_apresentacao'].label = 'Data (Inicial - Final)' self.filters['data_apresentacao'].label = 'Data (Inicial - Final)'
self.form.fields['tipo'].required = True self.form.fields['tipo'].required = True
self.form.fields['data_apresentacao'].required = True self.form.fields['data_apresentacao'].required = False
row1 = to_row([('tipo', 12)]) row1 = to_row([('tipo', 12)])
row2 = to_row([('data_apresentacao', 12)]) row2 = to_row([('data_apresentacao', 12)])
@ -714,7 +714,7 @@ class TramitacaoEmLoteFilterSet(django_filters.FilterSet):
self.filters['tramitacao__unidade_tramitacao_destino' self.filters['tramitacao__unidade_tramitacao_destino'
].label = 'Unidade Destino (Último Destino)' ].label = 'Unidade Destino (Último Destino)'
self.form.fields['tipo'].required = True self.form.fields['tipo'].required = True
self.form.fields['data_apresentacao'].required = True self.form.fields['data_apresentacao'].required = False
self.form.fields['tramitacao__status'].required = True self.form.fields['tramitacao__status'].required = True
self.form.fields[ self.form.fields[
'tramitacao__unidade_tramitacao_destino'].required = True 'tramitacao__unidade_tramitacao_destino'].required = True

Loading…
Cancel
Save