Browse Source

Migração das urls

stable/2.0
Breno Teixeira 11 years ago
parent
commit
4b35aa8d27
  1. 4
      sigi/apps/casas/admin.py
  2. 10
      sigi/apps/casas/models.py
  3. 4
      sigi/apps/contatos/models.py
  4. 2
      sigi/apps/convenios/templates/convenios/carrinho.html
  5. 7
      sigi/apps/convenios/urls.py
  6. 2
      sigi/apps/convenios/views.py
  7. 5
      sigi/apps/diagnosticos/urls.py
  8. 2
      sigi/apps/mesas/admin.py
  9. 1
      sigi/apps/parlamentares/admin.py
  10. 1
      sigi/apps/servicos/urls.py
  11. 6
      sigi/settings.py
  12. 16
      sigi/urls.py
  13. 2
      templates/admin/tabs_style.html
  14. 8
      templates/index.html
  15. 32
      templates/snippets/modules/actions.html
  16. 163
      templates/snippets/modules/charts-convenios.html
  17. 9
      templates/snippets/modules/user.html

4
sigi/apps/casas/admin.py

@ -20,6 +20,8 @@ from sigi.apps.inventario.models import Bem
from sigi.apps.servicos.models import Servico
from sigi.apps.metas.models import PlanoDiretor
from sigi.apps.ocorrencias.models import Ocorrencia
from django.utils.translation import ugettext as _
class TelefonesInline(generic.GenericTabularInline):
model = Telefone
@ -157,7 +159,7 @@ class CasaLegislativaAdmin(admin.ModelAdmin):
DiagnosticoInline, BemInline, ServicoInline, PlanoDiretorInline, OcorrenciaInline, )
list_display = ('nome','municipio','logradouro', 'ult_alt_endereco', 'get_convenios')
list_display_links = ('nome',)
list_filter = ('tipo', 'municipio', 'search_text')
list_filter = ('tipo', 'municipio__uf__nome', 'convenio__projeto')
ordering = ('nome','municipio__uf')
queyrset = queryset_ascii
fieldsets = (

10
sigi/apps/casas/models.py

@ -36,13 +36,13 @@ class CasaLegislativa(models.Model):
# Guarda um campo para ser usado em buscas em caixa baixa e sem acento
search_text = SearchField(field_names=['nome'])
search_text.projeto_filter = True
# search_text.projeto_filter = True
tipo = models.ForeignKey(TipoCasaLegislativa, verbose_name="Tipo")
cnpj = models.CharField('CNPJ', max_length=32, blank=True)
observacoes = models.TextField(u'observações', blank=True)
# num_parlamentares = models.PositiveIntegerField('Número de parlamentares')
codigo_interlegis = models.CharField('Código Interlegis', max_length=3, blank=True)
codigo_interlegis.ts_filter = True
# codigo_interlegis.ts_filter = True
# Informações de contato
logradouro = models.CharField(
@ -50,11 +50,13 @@ class CasaLegislativa(models.Model):
help_text='Avenida, rua, praça, jardim, parque...'
)
bairro = models.CharField(max_length=100, blank=True)
municipio = models.ForeignKey(
'contatos.Municipio',
verbose_name='município'
)
municipio.uf_filter = True
# municipio.uf_filter = True
cep = models.CharField(max_length=32)
email = models.EmailField('e-mail', max_length=128, blank=True)
pagina_web = models.URLField(
@ -263,7 +265,7 @@ class Funcionario(models.Model):
casa_legislativa = models.ForeignKey(CasaLegislativa)
nome = models.CharField('nome completo', max_length=60, blank=False)
nome.alphabetic_filter = True
# nome.alphabetic_filter = True
sexo = models.CharField(max_length=1, choices=SEXO_CHOICES, default="M")
nota = models.CharField(max_length=70, null=True, blank=True)
email = models.CharField('e-mail', max_length=75, blank=True)

4
sigi/apps/contatos/models.py

@ -5,6 +5,8 @@ from django.contrib.contenttypes import generic
from sigi.apps.utils import SearchField
from django.core.validators import MaxValueValidator, MinValueValidator
class UnidadeFederativa(models.Model):
""" Modelo que representa um estado brasileiro
"""
@ -21,7 +23,7 @@ class UnidadeFederativa(models.Model):
unique=True,
help_text='Código do estado segundo IBGE.'
)
nome = models.CharField(max_length=25)
nome = models.CharField('Nome UF', max_length=25)
# Campo de busca em caixa baixa sem acento
search_text = SearchField(field_names=['nome'])
sigla = models.CharField(

2
sigi/apps/convenios/templates/convenios/carrinho.html

@ -1,5 +1,5 @@
{% extends "admin/carrinho.html" %}
{% load adminmedia admin_list i18n %}
{% load admin_list i18n %}
{% block extrastyle %}
{{ block.super }}
{% include "admin/tabs_style.html" %}

7
sigi/apps/convenios/urls.py

@ -5,7 +5,8 @@ from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.convenios.views',
url(r'^reports/$', 'report', name='convenios-report'),
url(r'^carrinho/$', 'visualizar_carrinho', name='visualizar-carrinho'),
url(r'^carrinho/excluir_carrinho/$', 'excluir_carrinho', name='excluir-carrinho'),
url(r'^carrinho/deleta_itens_carrinho$', 'deleta_itens_carrinho', name='deleta-itens-carrinho'),
# url(r'^$', '', name=''),
url(r'^carrinho/excluir_carrinho/$', 'excluir_carrinho', name='excluir-carrinho'), #tagerror
url(r'^carrinho/deleta_itens_carrinho$', 'deleta_itens_carrinho', name='deleta-itens-carrinho'), #tagerror
url(r'^csv/$', 'export_csv', name='convenios-csv'),
url(r'^reportsRegiao/(?P<regiao>\w+)/$', 'report_regiao', name='convenios-report_regiao_pdf'),
)

2
sigi/apps/convenios/views.py

@ -39,7 +39,7 @@ def get_for_qs(get,qs):
kwargs = {}
ids = 0
for k,v in get.iteritems():
if not (k == 'page' or k == 'pop' or k == 'q'):
if k not in ['page', 'pop', 'q', '_popup']:
if not k == 'o':
if k == "ot":
qs = query_ordena(qs,get["o"],get["ot"])

5
sigi/apps/diagnosticos/urls.py

@ -30,6 +30,11 @@ urlpatterns = patterns('sigi.apps.diagnosticos.views',
# Reports diagnosticos
url(r'^diagnostico/(?P<id_diagnostico>\w+).pdf$', 'diagnostico_pdf', name='diagnostico-pdf'),
# Graficos de perguntas
url(r'^graficos/$', 'graficos', name="diagnosticos-graficos"), #tagerror
url(r'^api/$', 'grafico_api', name="diagnosticos-grafico-api"), #tagerror
)
urlpatterns += patterns('django.contrib.auth.views',

2
sigi/apps/mesas/admin.py

@ -16,7 +16,7 @@ class LegislaturaAdmin(admin.ModelAdmin):
list_display = ('numero', 'casa_legislativa', 'uf', 'data_inicio', 'data_fim', 'data_eleicao', 'total_parlamentares')
raw_id_fields = ('casa_legislativa',)
list_display_links = ('numero',)
list_filter = ('casa_legislativa', )
list_filter = ('casa_legislativa__municipio__uf', )
search_fields = ('casa_legislativa__nome', 'casa_legislativa__municipio__nome' )
inlines = (MandatoInline,)

1
sigi/apps/parlamentares/admin.py

@ -21,6 +21,7 @@ class PartidoAdmin(admin.ModelAdmin):
list_display_links = ('nome', 'sigla')
search_fields = ('nome', 'sigla')
class ParlamentarAdmin(admin.ModelAdmin):
inlines = (TelefonesInline, MandatosInline)
list_display = ('nome_completo', 'nome_parlamentar', 'sexo')

1
sigi/apps/servicos/urls.py

@ -9,4 +9,5 @@ urlpatterns = patterns('sigi.apps.servicos.views',
url(r'^manifesta/$', 'casa_manifesta_view', name="casa-manifesta-view"),
url(r'^munatenjson/(?P<servico>\w+)/$', 'municipios_atendidos', name="municipios-atendidos"),
url(r'^mapa/(?P<servico>\w+)/$', MapaView.as_view(), name="servicos-mapa"),
# url(r'^listacasas/(?P<sigla>\w+)', 'casas_usam_servico', name="casas-usam-servico"),
)

6
sigi/settings.py

@ -12,7 +12,6 @@ https://docs.djangoproject.com/en/dev/ref/settings/
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
@ -54,6 +53,9 @@ INSTALLED_APPS = (
# Third-party apps
'localflavor',
'reporting',
'django_extensions',
'googlecharts',
'treemenus',
)
MIDDLEWARE_CLASSES = (
@ -83,7 +85,7 @@ DATABASES = {
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'pt-br'
TIME_ZONE = 'UTC'

16
sigi/urls.py

@ -1,6 +1,8 @@
#-*- coding:utf-8 -*-
from django.conf.urls import patterns, include, url
from django.views.generic.base import RedirectView
from django.views.generic.base import RedirectView, TemplateView
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()
@ -13,8 +15,16 @@ urlpatterns = patterns('',
url(r'^sigi/convenios/convenio/', include('sigi.apps.convenios.urls')),
url(r'^sigi/diagnosticos/', include('sigi.apps.diagnosticos.urls')),
url(r'^sigi/servidores/', include('sigi.apps.servidores.urls')),
url(r'^sigi/dashboard/', include('sigi.apps.metas.urls')),
url(r'^sigi/servicos/', include('sigi.apps.servicos.urls')),
url(r'^sigi/dashboard/', include('sigi.apps.metas.urls')),
url(r'^sigi/', include(admin.site.urls)),
)
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG:
urlpatterns = patterns('',
url(r'^404/$', TemplateView.as_view(template_name='404.html')),
url(r'^500/$', TemplateView.as_view(template_name='500.html')),
url(r'^503/$', TemplateView.as_view(template_name='503.html')),
) + urlpatterns

2
templates/admin/tabs_style.html

@ -26,6 +26,6 @@
<style>
.ui-tabs-nav {
background-image: url("{{ADMIN_MEDIA_PREFIX}}img/admin/nav-bg.gif");
background-image: url("{{ MEDIA_URL }}img/admin/nav-bg.gif");
}
</style>

8
templates/index.html

@ -1,12 +1,12 @@
{% extends "admin/index.html" %}
{% load adminmedia %}
{% block title %}SIGI{% endblock %}
{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="{% admin_media_prefix %}js/core.js"></script>
<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.min.js"></script>
<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.init.js"></script>
{% load staticfiles %}
<script type="text/javascript" src="{% static "admin/js/core.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.min.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript">
(function($) {

32
templates/snippets/modules/actions.html

@ -0,0 +1,32 @@
{% load i18n log %}
<div class="module" id="recent-actions-module">
<h2>Atividades recentes</h2>
<h3>Últimas atividades</h3>
{% get_admin_log 10 as admin_log %}
{% if not admin_log %}
<p>Não disponível.</p>
{% else %}
<ul class="actionlist">
{% for entry in admin_log %}
<li class="{% if entry.is_addition %}addlink{% endif %}
{% if entry.is_change %}changelink{% endif %}
{% if entry.is_deletion %}deletelink{% endif %}">
{% if not entry.is_deletion %}<a href="{{ entry.get_admin_url }}">{% endif %}
{{ entry.object_repr|escape|truncatewords_html:3 }}
{% if not entry.is_deletion %}</a>{% endif %}
<br />
<span class="mini quiet">
{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}, por
<i>
{% if entry.user.first_name %}
{{ entry.user.first_name }}
{% else %}
{{ entry.user.username }}
{% endif %}
</i>
</span>
</li>
{% endfor %}
</ul>
{% endif %}
</div>

163
templates/snippets/modules/charts-convenios.html

@ -0,0 +1,163 @@
{% load charts %}
{% chart as convenios_assinados %}
{% chart-size 250 160 %}
{% chart-type "pie-3d" %}
{% chart-labels g_convassinado_proj.convenios %}
{% chart-data g_convassinado_proj.convenios %}
{% chart-legend g_convassinado_proj.projetos %}
{% chart-colors "A2CD5A,FFB90F,6CA6CD" %}
{% chart-title g_convassinado_proj.total_convenios %}
{% endchart %}
{% chart as processos %}
{% chart-size 250 160 %}
{% chart-type "pie-3d" %}
{% chart-labels g_conv_proj.convenios %}
{% chart-data g_conv_proj.convenios %}
{% chart-legend g_conv_proj.projetos %}
{% chart-colors "A2CD5A,FFB90F,6CA6CD" %}
{% chart-title g_conv_proj.total_convenios %}
{% endchart %}
<div class="module" style="height: 300px;">
<h2>Resumo de informações</h2>
<!-- h3>Câmaras municipais por projeto</h3 -->
<div class="align-center">
<table>
<tr>
{% for item in tabela_resumo_camara.cabecalho_topo %}
<th>{{item}}</th>
{% endfor %}
</tr>
{% for cabecalho,lista in tabela_resumo_camara.lista_zip %}
<tr>
<th>{{cabecalho}}</th>
{% for item in lista %}
<td>{{item}}</td>
{% endfor %}
</tr>
{% endfor %}
</table>
</div>
<ul>
<li>Câmaras sem processo: {{tabela_resumo_camara.camaras_sem_processo}}</li>
<li>Total de câmaras: {{tabela_resumo_camara.total_camaras}}</li>
</ul>
</div>
<div class="module" style="height: 300px;">
<h2>Convênios</h2>
<h3>Convênios assinados por projeto</h3>
<div class="align-center">
<img src="{{ convenios_assinados.url }}&chdlp=b" class="chart" />
</div>
</div>
<div class="module" style="height: 300px;">
<h2>Serviços</h2>
<div class="titlemapbox">
<div class="mapbox"><a href="/sigi/dashboard/mapa/"><img src="/sigi/media/images/mapicon.png"/><br/>Ver mapa</a></div>
<h3>Serviços hospedados no Interlegis (SEIT)</h3>
</div>
<table>
<tr>
</tr>
{% for servico in tabela_resumo_seit %}
<tr>
{% if forloop.first %}
<th style="width: 40%; vertical-align:bottom;">{{ servico.nome }}</th>
<th style="width: 20%; vertical-align:bottom; text-align: right;">{{ servico.total }}</th>
<th style="width: 20%; vertical-align:bottom; text-align: right;">{{ servico.novos_mes_anterior }}</th>
<th style="width: 20%; vertical-align:bottom; text-align: right;">{{ servico.novos_mes_atual }}</th>
{% else %}
<th style="width: 40%;">{{ servico.nome }}</th>
<td style="text-align: right;">{{ servico.total }}</td>
<td style="text-align: right;">{{ servico.novos_mes_anterior }}</td>
<td style="text-align: right;">{{ servico.novos_mes_atual }}</td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
<div class="module" style="height: 300px;">
<h2>Resumo de informações</h2>
<h3>Resumo de informações por região</h3>
<div >
<p style="text-align: justify">
Resumo de informações de Câmaras Municipais por região levando em conta
apenas o Projeto Interlegis. Demais projetos como PPM e PML não estão inclusos.
</p>
<ul class="conteudo_regiao">
<li><a href="reportsRegiao/CO">Centro Oeste</a></li>
<li><a href="reportsRegiao/NE">Nordeste</a></li>
<li><a href="reportsRegiao/NO">Norte</a></li>
<li><a href="reportsRegiao/SD">Sudeste</a></li>
<li><a href="reportsRegiao/SL">Sul</a></li>
</ul>
</div>
</div>
<div class="module" style="height: 300px;">
<h2>Convênios</h2>
<h3>Processos de convênios por projeto</h3>
<div class="align-center">
<img src="{{ processos.url }}&chdlp=b" class="chart" />
</div>
</div>
<div class="module" style="height: 300px;">
<h2>Atendimentos</h2>
<h3>Mapa de atuação do Interlegis</h3>
<div class="align-center">
<a href="/sigi/dashboard/mapa/"> <img src="/sigi/media/images/mapicon-large.png" style="width: 60%;"/> </a>
</div>
{% comment %}
<h2>Metas BID</h2>
<h3>Estado das metas do contrato BID</h3>
<table style="margin: auto;">
{% for meta in metas %}
<tr>
<td><strong>{{ meta.titulo }}</strong></td>
<td>
<img src="//chart.googleapis.com/chart?chf=c,s,CDCDCD&chbh=a&chs=250x18&cht=bhs&chco={{ meta.saude }}&chd=t:{{ meta.percentual_concluido|stringformat:'d' }}&chm=r,00000034,0,{{ meta.percentual_desejado_low|stringformat:'f' }},{{ meta.percentual_desejado_high|stringformat:'f' }},1"
width="100%" alt="" />
</td>
<td style="text-align: center;"><font color="{{ meta.saude }}">{{ meta.percentual_concluido }}%</font></td>
</tr>
{% endfor %}
</table>
<div class="legend">
<span><div style="background-color: #E74A69;">&nbsp;</div>Ruim</span>
<span><div style="background-color: #FFDB6E;">&nbsp;</div>Preocupante</span>
<span><div style="background-color: #89D7AF;">&nbsp;</div>Bom</span>
<span><div style="background-color: #A2BBED;">&nbsp;</div>Atingido</span>
</div>
{% endcomment %}
</div>
{% comment %}
<div class="module" style="height: 300px;">
<h2>Diagnósticos</h2>
<h3>Resumo dos diagnósticos</h3>
<table style="display: block; float: left;">
{% for data in tabela_resumo_diagnostico %}
<tr>
<th>{{ data.title }}</th>
<td style="text-align: right;">{{ data.count }}</td>
</tr>
{% endfor %}
<tr><td colspan="2"><a href="/sigi/diagnosticos/mapa/">Ver mapa ampliado</a></td></tr>
</table>
<div id="map_canvas" style="float: left; height: 80%; width: 300px;">
</div>
</div>
{% endcomment %}

9
templates/snippets/modules/user.html

@ -0,0 +1,9 @@
{% load i18n tree_menu_tags %}
{% if user.is_superuser %}
<div class="module" id="user-module">
<h3>{{ user.get_full_name }}</h3>
<h3>Administração</h3>
{% show_menu "Administrador" "unordered-list" %}
</div>
{% endif %}
Loading…
Cancel
Save