diff --git a/sigi/apps/servidores/views.py b/sigi/apps/servidores/views.py new file mode 100644 index 0000000..bef9289 --- /dev/null +++ b/sigi/apps/servidores/views.py @@ -0,0 +1,33 @@ +# -*- coding: utf8 -*- + +import new +from django.template import RequestContext +from django.shortcuts import render_to_response, get_object_or_404, redirect +from django.db.models import Avg, Max, Min, Count +from sigi.apps.servidores.models import Servidor, Funcao +from sigi.shortcuts import render_to_pdf + +def servidores_por_funcao(request): + report = Funcao.objects.values('funcao').annotate(funcao__count=Count('funcao')).order_by('funcao__count') + total = Funcao.objects.count() + + context = RequestContext(request, { + 'pagesize':'A4', + 'report': report, + 'total': total + }) + + return render_to_pdf('servidores/servidores_por_funcao.html', context) + +def servidores_por_cargo(request): + report = Funcao.objects.values('cargo').annotate(cargo__count=Count('cargo')).order_by('cargo__count') + total = Funcao.objects.count() + + context = RequestContext(request, { + 'pagesize':'A4', + 'report': report, + 'total': total + }) + + return render_to_pdf('servidores/servidores_por_cargo.html', context) + diff --git a/sigi/templates/admin/servidores/servidor/change_list.html b/sigi/templates/admin/servidores/servidor/change_list.html new file mode 100644 index 0000000..f688d16 --- /dev/null +++ b/sigi/templates/admin/servidores/servidor/change_list.html @@ -0,0 +1,20 @@ +{% extends 'admin/change_list.html' %} +{% load i18n reporting_tags %} + +{% block object-tools %} +
+ |
+ SENADO FEDERAL +SECRETARIA ESPECIAL DO INTERLEGIS – SINTER +{% block subsecretaria %}{% endblock %} + |
+ + |
+ | Cargo | +Servidores | +
{{ forloop.counter }} | +{{ r.cargo }} | +{{ r.cargo__count }} | +
+ | Total | +{{ total }} | +
+ | Função | +Servidores | +
{{ forloop.counter }} | +{{ r.funcao }} | +{{ r.funcao__count }} | +
+ | Total | +{{ total }} | +