From cb5efe5b81d7231041dd5cb04e10697c4e075d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Rodrigues?= Date: Thu, 25 Jun 2020 16:09:21 -0300 Subject: [PATCH] =?UTF-8?q?Altera=20posi=C3=A7=C3=A3o=20de=20valida=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/base/forms.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sapl/base/forms.py b/sapl/base/forms.py index b1ce0f9e8..e8960ac83 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -668,16 +668,15 @@ class AutorForm(ModelForm): _('O Tipo do Autor deve ser selecionado.')) tipo = cd['tipo'] - - if 'nome' in cd and \ - qs_autor.filter(nome=cd['nome']).exists(): - raise ValidationError("Autor '%s' já existente!" % cd['nome']) - if not tipo.content_type: if 'nome' not in cd or not cd['nome']: self.logger.warn('Nome do Autor não informado.') raise ValidationError( _('O Nome do Autor deve ser informado.')) + + if 'nome' in cd and \ + qs_autor.filter(nome=cd['nome']).exists(): + raise ValidationError("Autor '%s' já existente!" % cd['nome']) else: if 'autor_related' not in cd or not cd['autor_related']: self.logger.warn(