From 91d66fecf48074036a27528c90f33293be5a2b0d Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Fri, 17 Mar 2017 13:40:41 -0300 Subject: [PATCH] Finalmente consertado --- sapl/parlamentares/views.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index bc3ebf261..485439d93 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -307,21 +307,20 @@ class ParlamentarCrud(Crud): def get_queryset(self): queryset = super().get_queryset() - legislatura_id = self.take_legislatura_id() if legislatura_id != 0: return queryset.filter( mandato__legislatura_id=legislatura_id) else: try: - l = Legislatura.objects.all().order_by('-data_inicio').first() + l = Legislatura.objects.all().order_by( + '-data_inicio').first() except ObjectDoesNotExist: - return [] + return Legislatura.objects.all() else: - if l: - return queryset.filter(mandato__legislatura_id=l.pk) - else: - return [] + if l is None: + return Legislatura.objects.all() + return queryset.filter(mandato__legislatura_id=l) def get_headers(self): return ['', _('Parlamentar'), _('Partido'), _('Ativo?')]