From be8dfb4e86f10ffed92d68a9cf416b89a5dc4c47 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Fri, 17 Mar 2017 13:29:43 -0300 Subject: [PATCH] Fixes #904 --- sapl/parlamentares/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index 7365168e5..bc3ebf261 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -318,7 +318,10 @@ class ParlamentarCrud(Crud): except ObjectDoesNotExist: return [] else: - return queryset.filter(mandato__legislatura_id=l.pk) + if l: + return queryset.filter(mandato__legislatura_id=l.pk) + else: + return [] def get_headers(self): return ['', _('Parlamentar'), _('Partido'), _('Ativo?')]