From a11c2b8f0d09fb470c95a66630952c5cfb46965d Mon Sep 17 00:00:00 2001 From: Sesostris Vieira Date: Tue, 30 Oct 2012 14:36:06 +0000 Subject: [PATCH] =?UTF-8?q?Corrige=20bug=20que=20ocorre=20na=20interface?= =?UTF-8?q?=20mobile=20de=20diagn=C3=B3sticos=20quando=20uma=20Casa=20tem?= =?UTF-8?q?=20mais=20que=20um=20funcion=C3=A1rio=20num=20mesmo=20setor.=20?= =?UTF-8?q?-=20Inclui=20gera=C3=A7=C3=A3o=20de=20PDF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/diagnosticos/views.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sigi/apps/diagnosticos/views.py b/sigi/apps/diagnosticos/views.py index 8b66963..c7b6101 100644 --- a/sigi/apps/diagnosticos/views.py +++ b/sigi/apps/diagnosticos/views.py @@ -163,8 +163,6 @@ def categoria_contatos(request, id_diagnostico): for f in casa_legislativa.funcionario_set.filter(setor=n): funcionarios.append((f, False)) - print funcionarios - if request.method == "POST": forms = [] for f, c in funcionarios: @@ -230,8 +228,13 @@ def diagnostico_pdf(request, id_diagnostico): categorias = Categoria.objects.all() casa_legislativa = diagnostico.casa_legislativa - funcionarios = [casa_legislativa.funcionario_set.get_or_create(setor=n)[0] - for n, l in Funcionario.SETOR_CHOICES] + funcionarios = [] + for n, l in Funcionario.SETOR_CHOICES: + if casa_legislativa.funcionario_set.filter(setor=n).count() <= 1: + funcionarios.append(casa_legislativa.funcionario_set.get_or_create(setor=n)) + else: + for f in casa_legislativa.funcionario_set.filter(setor=n): + funcionarios.append(f) schemas_by_categoria = [] for categoria in categorias: