From cd30c94e23d77a7de55b2fc4e14fcc9910ebbad9 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Thu, 14 Sep 2017 15:50:30 -0300 Subject: [PATCH 1/2] Adiciona checagem em clean() de ordemdia e maexpedientemateria --- sapl/sessao/forms.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index 656a0e1cc..a31aee70a 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -157,12 +157,11 @@ class ExpedienteMateriaForm(ModelForm): return self.instance.sessao_plenaria.data_inicio def clean(self): - super(ExpedienteMateriaForm, self).clean() + cleaned_data = super(ExpedienteMateriaForm, self).clean() - if self.errors: - return self.errors + if not self.is_valid(): + return cleaned_data - cleaned_data = self.cleaned_data sessao = self.instance.sessao_plenaria try: @@ -220,7 +219,9 @@ class OrdemDiaForm(ExpedienteMateriaForm): return self.cleaned_data['numero_ordem'] def clean(self): - super(OrdemDiaForm, self).clean() + cleaned_data = super(OrdemDiaForm, self).clean() + if not self.is_valid(): + return cleaned_data return self.cleaned_data def save(self, commit=False): From 8e9d911eec0d50228961ed00f22318a5d76dbcce Mon Sep 17 00:00:00 2001 From: Luciano Henrique Nunes de Almeida Date: Fri, 15 Sep 2017 14:07:54 -0300 Subject: [PATCH 2/2] =?UTF-8?q?Concerta=20data=20de=20fim=20de=20mandato?= =?UTF-8?q?=20na=20migra=C3=A7=C3=A3o=20(#1484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Luciano Almeida --- sapl/legacy/migration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py index b03514366..2d586c326 100644 --- a/sapl/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -424,9 +424,9 @@ def adjust_mandato(new, old): if old.dat_fim_mandato: new.data_fim_mandato = old.dat_fim_mandato if not new.data_fim_mandato: - legislatura = Legislatura.objects.latest('data_fim') - new.data_fim_mandato = legislatura.data_fim - new.data_expedicao_diploma = legislatura.data_inicio + new.data_fim_mandato = new.legislatura.data_fim + if not new.data_inicio_mandato: + new.data_inicio_mandato = new.legislatura.data_inicio def adjust_ordemdia_antes_salvar(new, old):