From 8aa56ad1a5b28361beff9a747278644b67fdd6a4 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Mon, 20 Mar 2017 12:28:43 -0300 Subject: [PATCH] =?UTF-8?q?Conserta=20bug=20em=20formul=C3=A1rio=20de=20Ma?= =?UTF-8?q?ndato?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/parlamentares/forms.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sapl/parlamentares/forms.py b/sapl/parlamentares/forms.py index 618e0445e..cd70ca995 100644 --- a/sapl/parlamentares/forms.py +++ b/sapl/parlamentares/forms.py @@ -61,9 +61,10 @@ class MandatoForm(ModelForm): def clean(self): data = self.cleaned_data try: - mandato = Mandato.objects.get( - parlamentar__pk=self.initial['parlamentar'].pk, - legislatura__pk=data['legislatura'].pk) + if 'legislatura' in data and 'parlamentar' in data: + mandato = Mandato.objects.get( + parlamentar__pk=self.initial['parlamentar'].pk, + legislatura__pk=data['legislatura'].pk) except ObjectDoesNotExist: pass else: