From 350475a1dbd27071a0f4c4b7407d85ab0fab432a Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Wed, 6 Feb 2019 16:58:26 -0200 Subject: [PATCH] =?UTF-8?q?corrige=20l=C3=B3gica=20de=20tratamento=20de=20?= =?UTF-8?q?despachos=20iniciais?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/materia/forms.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index c8ba3e4cf..cdb21021d 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -196,7 +196,7 @@ class MateriaLegislativaForm(ModelForm): def __init__(self, *args, **kwargs): super(MateriaLegislativaForm, self).__init__(*args, **kwargs) - + self.fields['ementa'].widget.attrs['maxlength'] = 1000 if self.instance and self.instance.pk: @@ -989,8 +989,9 @@ class DespachoInicialForm(ModelForm): if DespachoInicial.objects.filter( materia=self.instance.materia, comissao=self.cleaned_data['comissao'], - ).exists(): - msg = _('Esse Despacho já foi cadastrado.') + ).exclude(pk=self.instance.pk).exists(): + msg = _('Já existe um Despacho cadastrado para %s' % + self.cleaned_data['comissao']) raise ValidationError(msg) return self.cleaned_data