diff --git a/sapl/crud/base.py b/sapl/crud/base.py index 6f67af03e..5e55acaff 100644 --- a/sapl/crud/base.py +++ b/sapl/crud/base.py @@ -354,7 +354,6 @@ class CrudListView(PermissionRequiredContainerCrudMixin, ListView): for fieldname in self.list_field_names: if not isinstance(fieldname, tuple): fieldname = fieldname, - s = [] for fn in fieldname: m = self.model diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index 105bd0679..e567d5cf2 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -122,6 +122,21 @@ class MandatoCrud(MasterDetailCrud): class ListView(MasterDetailCrud.ListView): ordering = ('-legislatura__numero') + def get_headers(self): + return [_('Legislatura'), _('Votos do Mandato'), + _('Coligação'), _('Votos da Coligação')] + + def get_rows(self, object_list): + mandatos = [] + for m in object_list: + mandato = [(m, reverse('sapl.parlamentares:mandato_detail', + kwargs={'pk': m.pk})), + (m.votos_recebidos, None), + (m.coligacao, None), + (m.coligacao.numero_votos, None)] + mandatos.append(mandato) + return mandatos + class ComposicaoColigacaoCrud(MasterDetailCrud): model = ComposicaoColigacao