From 15841ca69ecb3bf0192088d25eb50c3c4b776d62 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Thu, 12 Mar 2015 11:21:16 -0300 Subject: [PATCH] Add filter for occurrences managed by the current user --- sigi/apps/ocorrencias/filters.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sigi/apps/ocorrencias/filters.py b/sigi/apps/ocorrencias/filters.py index 533d373..ae8a859 100644 --- a/sigi/apps/ocorrencias/filters.py +++ b/sigi/apps/ocorrencias/filters.py @@ -14,11 +14,14 @@ class OcorrenciaListFilter(admin.SimpleListFilter): return ( ('S', _(u'AtribuĂ­dos ao meu setor')), ('M', _(u'Registrados por mim')), + ('G', _(u'Sobre casas que gerencio')), ) def queryset(self, request, queryset): servidor = Servidor.objects.get(user=request.user) if self.value() == 'S': return queryset.filter(setor_responsavel=servidor.servico) - if self.value() == 'M': + elif self.value() == 'M': return queryset.filter(servidor_registro=servidor) + elif self.value() == 'G': + return queryset.filter(casa_legislativa__gerente_contas=servidor)