From 02f0b9e4e7ffb5186979413c289091befa013ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Matheus?= Date: Thu, 11 Apr 2019 18:15:26 -0300 Subject: [PATCH] Fix #2719 em Anexada --- sapl/materia/forms.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index edbeed810..8c4006bae 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -790,6 +790,13 @@ class AnexadaForm(ModelForm): cleaned_data = self.cleaned_data + data_anexacao = cleaned_data['data_anexacao'] + data_desanexacao = cleaned_data['data_desanexacao'] if cleaned_data['data_desanexacao'] else data_anexacao + + if data_anexacao > data_desanexacao: + self.logger.error("Data de anexação posterior à data de desanexação.") + raise ValidationError(_("Data de anexação posterior à data de desanexação.")) + try: self.logger.info("Tentando obter objeto MateriaLegislativa (numero={}, ano={}, tipo={})." .format(cleaned_data['numero'], cleaned_data['ano'], cleaned_data['tipo']))