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?')]