Browse Source

Fix #676

pull/691/head
Eduardo Edson Batista Cordeiro Alves 8 years ago
parent
commit
3d679c9f00
  1. 1
      sapl/crud/base.py
  2. 15
      sapl/parlamentares/views.py

1
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

15
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

Loading…
Cancel
Save