From 8841c6a05e91e58c93392d1106e089d2c9ad66c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Tue, 18 Dec 2012 19:54:13 -0200 Subject: [PATCH] =?UTF-8?q?Adicionar=20n=C3=BAmero=20de=20parlamentares=20?= =?UTF-8?q?e=20data=20de=20=C3=BAltima=20altera=C3=A7=C3=A3o=20de=20endere?= =?UTF-8?q?=C3=A7o=20na=20exporta=C3=A7=C3=A3o=20de=20dados=20das=20Casas?= =?UTF-8?q?=20Legislativas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/casas/models.py | 17 +++++++++++++++++ sigi/apps/casas/templates/casas/carrinho.html | 12 ++++++++++++ sigi/apps/casas/views.py | 4 ++++ sigi/apps/mesas/models.py | 1 + 4 files changed, 34 insertions(+) diff --git a/sigi/apps/casas/models.py b/sigi/apps/casas/models.py index 1df934e..6895ff5 100644 --- a/sigi/apps/casas/models.py +++ b/sigi/apps/casas/models.py @@ -99,6 +99,23 @@ class CasaLegislativa(models.Model): return self.funcionario_set.get(setor='presidente') except Funcionario.DoesNotExist: return None + + @property + def total_parlamentares(self): + """ + Calcula o total de parlamentares atual da Casa: + - O total de parlamentares da mesas.legislatura mais recente, ou + - num_parlamentares ou + - 0 se não tiver nenhuma das informações + """ + + if self.legislatura_set.exists(): + return self.legislatura_set.all()[0].total_parlamentares + + if self.num_parlamentares is not None: + return self.num_parlamentares + + return 0 def gerarCodigoInterlegis(self): codigo = self.codigo_interlegis diff --git a/sigi/apps/casas/templates/casas/carrinho.html b/sigi/apps/casas/templates/casas/carrinho.html index 11cf8e5..5ec64ae 100644 --- a/sigi/apps/casas/templates/casas/carrinho.html +++ b/sigi/apps/casas/templates/casas/carrinho.html @@ -167,6 +167,18 @@ value="Email" class="action-select" checked="checked" /> +
  • + + + +
  • +
  • + + + +