Browse Source

Adiciona uma chamada a super() em clean de forms (#1206)

pull/1207/head
Edward 8 years ago
committed by GitHub
parent
commit
f61a9ed191
  1. 4
      sapl/base/forms.py
  2. 23
      sapl/materia/forms.py
  3. 4
      sapl/norma/forms.py
  4. 12
      sapl/parlamentares/forms.py
  5. 8
      sapl/protocoloadm/forms.py
  6. 8
      sapl/sessao/forms.py

4
sapl/base/forms.py

@ -227,6 +227,8 @@ class AutorForm(ModelForm):
return True
def clean(self):
super(AutorForm, self).clean()
User = get_user_model()
cd = self.cleaned_data
@ -725,6 +727,8 @@ class RecuperarSenhaForm(PasswordResetForm):
super(RecuperarSenhaForm, self).__init__(*args, **kwargs)
def clean(self):
super(RecuperarSenhaForm, self).clean()
email_existente = User.objects.filter(
email=self.data['email']).exists()

23
sapl/materia/forms.py

@ -124,6 +124,8 @@ class UnidadeTramitacaoForm(ModelForm):
fields = ['comissao', 'orgao', 'parlamentar']
def clean(self):
super(UnidadeTramitacaoForm, self).clean()
cleaned_data = self.cleaned_data
for key in list(cleaned_data.keys()):
@ -179,6 +181,8 @@ class RelatoriaForm(ModelForm):
super(RelatoriaForm, self).__init__(*args, **kwargs)
def clean(self):
super(RelatoriaForm, self).clean()
cleaned_data = self.cleaned_data
try:
@ -211,6 +215,7 @@ class TramitacaoForm(ModelForm):
self.fields['data_tramitacao'].initial = datetime.now()
def clean(self):
super(TramitacaoForm, self).clean()
if 'data_encaminhamento' in self.data:
data_enc_form = self.cleaned_data['data_encaminhamento']
@ -288,6 +293,8 @@ class TramitacaoUpdateForm(TramitacaoForm):
}
def clean(self):
super(TramitacaoUpdateForm, self).clean()
local = self.instance.unidade_tramitacao_local
data_tram = self.instance.data_tramitacao
@ -328,6 +335,8 @@ class LegislacaoCitadaForm(ModelForm):
'item']
def clean(self):
super(LegislacaoCitadaForm, self).clean()
if self.errors:
return self.errors
@ -389,6 +398,8 @@ class NumeracaoForm(ModelForm):
'data_materia']
def clean(self):
super(NumeracaoForm, self).clean()
if self.errors:
return self.errors
@ -432,6 +443,8 @@ class AnexadaForm(ModelForm):
return super(AnexadaForm, self).__init__(*args, **kwargs)
def clean(self):
super(AnexadaForm, self).clean()
if self.errors:
return self.errors
@ -612,6 +625,8 @@ class DespachoInicialForm(ModelForm):
fields = ['comissao']
def clean(self):
super(DespachoInicialForm, self).clean()
if self.errors:
return self.errors
@ -632,6 +647,8 @@ class AutoriaForm(ModelForm):
fields = ['autor', 'primeiro_autor']
def clean(self):
super(AutoriaForm, self).clean()
if self.errors:
return self.errors
@ -803,6 +820,8 @@ class TipoProposicaoForm(ModelForm):
'tipo_conteudo_related'].initial = self.instance.object_id
def clean(self):
super(TipoProposicaoForm, self).clean()
cd = self.cleaned_data
content_type = cd['content_type']
@ -1001,6 +1020,8 @@ class ProposicaoForm(forms.ModelForm):
return texto_original
def clean(self):
super(ProposicaoForm, self).clean()
cd = self.cleaned_data
tm, am, nm = (cd.get('tipo_materia', ''),
@ -1207,6 +1228,8 @@ class ConfirmarProposicaoForm(ProposicaoForm):
self.fields['gerar_protocolo'].initial = True
def clean(self):
super(ConfirmarProposicaoForm, self).clean()
numeracao = sapl.base.models.AppConfig.attr('sequencia_numeracao')
if not numeracao:

4
sapl/norma/forms.py

@ -118,6 +118,8 @@ class NormaJuridicaForm(ModelForm):
widgets = {'assuntos': widgets.CheckboxSelectMultiple}
def clean(self):
super(NormaJuridicaForm, self).clean()
cleaned_data = self.cleaned_data
if (cleaned_data['tipo_materia'] and
@ -175,6 +177,8 @@ class NormaRelacionadaForm(ModelForm):
super(NormaRelacionadaForm, self).__init__(*args, **kwargs)
def clean(self):
super(NormaRelacionadaForm, self).clean()
if self.errors:
return self.errors
cleaned_data = self.cleaned_data

12
sapl/parlamentares/forms.py

@ -59,6 +59,8 @@ class MandatoForm(ModelForm):
widgets = {'parlamentar': forms.HiddenInput()}
def clean(self):
super(MandatoForm, self).clean()
data = self.cleaned_data
try:
if 'legislatura' in data and 'parlamentar' in data:
@ -82,6 +84,8 @@ class LegislaturaForm(ModelForm):
class LegislaturaCreateForm(LegislaturaForm):
def clean(self):
super(LegislaturaCreateForm, self).clean()
cleaned_data = self.cleaned_data
eleicao = cleaned_data['data_eleicao']
inicio = cleaned_data['data_inicio']
@ -96,6 +100,8 @@ class LegislaturaCreateForm(LegislaturaForm):
class LegislaturaUpdateForm(LegislaturaCreateForm):
def clean(self):
super(LegislaturaUpdateForm, self).clean()
cleaned_data = super(LegislaturaCreateForm, self).clean()
eleicao = cleaned_data['data_eleicao']
inicio = cleaned_data['data_inicio']
@ -214,6 +220,8 @@ class FiliacaoForm(ModelForm):
'data_desfiliacao']
def clean(self):
super(FiliacaoForm, self).clean()
if self.errors:
return self.errors
@ -236,6 +244,8 @@ class ComposicaoColigacaoForm(ModelForm):
fields = ['partido']
def clean(self):
super(ComposicaoColigacaoForm, self).clean()
cleaned_data = self.cleaned_data
pk = self.initial['coligacao_id']
if (ComposicaoColigacao.objects.filter(
@ -311,6 +321,8 @@ class VotanteForm(ModelForm):
return True
def clean(self):
super(VotanteForm, self).clean()
cd = self.cleaned_data
username = cd['username']

8
sapl/protocoloadm/forms.py

@ -213,6 +213,8 @@ class AnularProcoloAdmForm(ModelForm):
widget=forms.Textarea)
def clean(self):
super(AnularProcoloAdmForm, self).clean()
cleaned_data = super(AnularProcoloAdmForm, self).clean()
numero = cleaned_data.get("numero")
@ -430,6 +432,8 @@ class TramitacaoAdmForm(ModelForm):
}
def clean(self):
super(TramitacaoAdmForm, self).clean()
data_enc_form = self.cleaned_data['data_encaminhamento']
data_prazo_form = self.cleaned_data['data_fim_prazo']
data_tram_form = self.cleaned_data['data_tramitacao']
@ -502,6 +506,8 @@ class TramitacaoAdmEditForm(TramitacaoAdmForm):
}
def clean(self):
super(TramitacaoAdmEditForm, self).clean()
local = self.instance.unidade_tramitacao_local
data_tram = self.instance.data_tramitacao
@ -542,6 +548,8 @@ class DocumentoAdministrativoForm(ModelForm):
widgets = {'protocolo': forms.HiddenInput()}
def clean(self):
super(DocumentoAdministrativoForm, self).clean()
numero_protocolo = self.data['numero_protocolo']
ano_protocolo = self.data['ano_protocolo']

8
sapl/sessao/forms.py

@ -60,6 +60,8 @@ class BancadaForm(ModelForm):
'data_extincao', 'descricao']
def clean(self):
super(BancadaForm, self).clean()
if self.cleaned_data['data_extincao']:
if (self.cleaned_data['data_extincao'] <
self.cleaned_data['data_criacao']):
@ -110,6 +112,8 @@ class ExpedienteMateriaForm(ModelForm):
return self.instance.sessao_plenaria.data_inicio
def clean(self):
super(ExpedienteMateriaForm, self).clean()
cleaned_data = self.cleaned_data
sessao = self.instance.sessao_plenaria
@ -166,6 +170,8 @@ class OrdemDiaForm(ExpedienteMateriaForm):
return self.cleaned_data['numero_ordem']
def clean(self):
super(OrdemDiaForm, self).clean()
cleaned_data = self.cleaned_data
sessao = self.instance.sessao_plenaria
@ -426,6 +432,8 @@ class ResumoOrdenacaoForm(forms.Form):
)
def clean(self):
super(ResumoOrdenacaoForm, self).clean()
cleaned_data = self.cleaned_data
for c1 in cleaned_data:

Loading…
Cancel
Save