diff --git a/moodlerouter.py b/moodlerouter.py index 4ea4aa1..c5ba346 100644 --- a/moodlerouter.py +++ b/moodlerouter.py @@ -18,7 +18,7 @@ class MoodleRouter(object): return True return None - def allow_migrate(self, db, model): - if model._meta.app_label == 'mdl': + def allow_migrate(self, db, app_label, model_name=None, **hints): + if app_label == 'mdl': return False return None diff --git a/sigi/apps/casas/urls.py b/sigi/apps/casas/urls.py index 4ad3519..1c403dc 100644 --- a/sigi/apps/casas/urls.py +++ b/sigi/apps/casas/urls.py @@ -1,37 +1,37 @@ # coding: utf-8 from django.conf.urls import patterns, url +from sigi.apps.casas import views -urlpatterns = patterns( - 'sigi.apps.casas.views', +urlpatterns = [ # Informacoes de uma casa legislativa - url(r'^casalegislativa/report_complete/$', 'report_complete', name='report-complete-all'), - url(r'^casalegislativa/(?P\w+)/report_complete/$', 'report_complete', name='report-complete-id'), + url(r'^casalegislativa/report_complete/$', views.report_complete, name='report-complete-all'), + url(r'^casalegislativa/(?P\w+)/report_complete/$', views.report_complete, name='report-complete-id'), # Reports Labels - url(r'^casalegislativa/labels/$', 'labels_report', name='labels-report-all'), - url(r'^casalegislativa/(?P\w+)/labels/$', 'labels_report', name='labels-report-id'), + url(r'^casalegislativa/labels/$', views.labels_report, name='labels-report-all'), + url(r'^casalegislativa/(?P\w+)/labels/$', views.labels_report, name='labels-report-id'), # Reports Labels Parlamentar - url(r'^casalegislativa/labels_parlamentar/$', 'labels_report_parlamentar', name='lebels-report-parlamentar-all'), - url(r'^casalegislativa/(?P\w+)/labels_parlamentar/$', 'labels_report_parlamentar', name='labels-report-parlamentar-id'), + url(r'^casalegislativa/labels_parlamentar/$', views.labels_report_parlamentar, name='lebels-report-parlamentar-all'), + url(r'^casalegislativa/(?P\w+)/labels_parlamentar/$', views.labels_report_parlamentar, name='labels-report-parlamentar-id'), # Reports labels sem presidente - url(r'^casalegislativa/labels_sem_presidente/$', 'labels_report_sem_presidente', name='labels-report-sem-presidente-all'), - url(r'^casalegislativa/(?P\w+)/labels_sem_presidente/$', 'labels_report_sem_presidente', name='labels-report-sem-presidente-id'), + url(r'^casalegislativa/labels_sem_presidente/$', views.labels_report_sem_presidente, name='labels-report-sem-presidente-all'), + url(r'^casalegislativa/(?P\w+)/labels_sem_presidente/$', views.labels_report_sem_presidente, name='labels-report-sem-presidente-id'), # Reports casas sem convenio - url(r'^casalegislativa/reports/$', 'report', name='casa-report'), - url(r'^casalegislativa/casas_sem_convenio_report/$', 'casas_sem_convenio_report', name='casas-sem-convenio-report'), + url(r'^casalegislativa/reports/$', views.report, name='casa-report'), + url(r'^casalegislativa/casas_sem_convenio_report/$', views.casas_sem_convenio_report, name='casas-sem-convenio-report'), # CSV - url(r'^casalegislativa/csv/$', 'export_csv', name='casa-export-csv'), # Error + url(r'^casalegislativa/csv/$', views.export_csv, name='casa-export-csv'), # Error # Carrinho - url(r'^casalegislativa/carrinho/$', 'visualizar_carrinho', name='visualizar-carrinho'), - url(r'^casalegislativa/carrinho/excluir_carrinho/$', 'excluir_carrinho', name='excluir-carrinho'), # Error - url(r'^casalegislativa/carrinho/deleta_itens_carrinho$', 'deleta_itens_carrinho', name='deleta-itens-carrinho'), # Error - url(r'^portfolio/$', 'portfolio', name='casas-portfolio'), - url(r'^carteira/$', 'painel_relacionamento', name='casas-carteira'), -) + url(r'^casalegislativa/carrinho/$', views.visualizar_carrinho, name='visualizar-carrinho'), + url(r'^casalegislativa/carrinho/excluir_carrinho/$', views.excluir_carrinho, name='excluir-carrinho'), # Error + url(r'^casalegislativa/carrinho/deleta_itens_carrinho$', views.deleta_itens_carrinho, name='deleta-itens-carrinho'), # Error + url(r'^portfolio/$', views.portfolio, name='casas-portfolio'), + url(r'^carteira/$', views.painel_relacionamento, name='casas-carteira'), +] diff --git a/sigi/apps/convenios/urls.py b/sigi/apps/convenios/urls.py index a8917ef..94a8845 100644 --- a/sigi/apps/convenios/urls.py +++ b/sigi/apps/convenios/urls.py @@ -1,13 +1,12 @@ # coding: utf-8 -from django.conf.urls import patterns, url +from django.conf.urls import url +from sigi.apps.convenios import views -urlpatterns = patterns( - 'sigi.apps.convenios.views', - - url(r'^convenio/reports/$', 'report', name='convenios-report'), - url(r'^convenio/carrinho/$', 'visualizar_carrinho', name='visualizar-carrinho'), - url(r'^convenio/carrinho/excluir_carrinho/$', 'excluir_carrinho', name='excluir-carrinho'), # tagerror - url(r'^convenio/carrinho/deleta_itens_carrinho$', 'deleta_itens_carrinho', name='deleta-itens-carrinho'), # tagerror - url(r'^convenio/csv/$', 'export_csv', name='convenios-csv'), - url(r'^reportsRegiao/(?P\w+)/$', 'report_regiao', name='convenios-report_regiao_pdf'), -) +urlpatterns = [ + url(r'^convenio/reports/$', views.report, name='convenios-report'), + url(r'^convenio/carrinho/$', views.visualizar_carrinho, name='visualizar-carrinho'), + url(r'^convenio/carrinho/excluir_carrinho/$', views.excluir_carrinho, name='excluir-carrinho'), # tagerror + url(r'^convenio/carrinho/deleta_itens_carrinho$', views.deleta_itens_carrinho, name='deleta-itens-carrinho'), # tagerror + url(r'^convenio/csv/$', views.export_csv, name='convenios-csv'), + url(r'^reportsRegiao/(?P\w+)/$', views.report_regiao, name='convenios-report_regiao_pdf'), +] diff --git a/sigi/apps/diagnosticos/urls.py b/sigi/apps/diagnosticos/urls.py index 1b4d551..95957c7 100644 --- a/sigi/apps/diagnosticos/urls.py +++ b/sigi/apps/diagnosticos/urls.py @@ -1,51 +1,57 @@ # -*- coding: utf-8 -*- -from django.conf.urls import patterns, url +from django.conf.urls import url from django.views.generic import TemplateView +from sigi.apps.diagnosticos import views as diagnosticos_views +from django.contrib.auth import views as auth_views -LOGIN_REDIRECT_URL = '/diagnosticos/mobile/login' - -urlpatterns = patterns( - 'sigi.apps.diagnosticos.views', +urlpatterns = [ # Lista de Diagnósticos - url(r'^mobile/$', 'lista', name='lista_diagnosticos'), + url(r'^mobile/$', diagnosticos_views.lista, name='lista_diagnosticos'), # Lista de Categorias url(r'^mobile/(?P\d+)/categorias/$', - 'categorias', name='lista_categorias'), + diagnosticos_views.categorias, name='lista_categorias'), # Detalhes da Categoria da Casa Legislativa url(r'^mobile/(?P\d+)/categorias/1/$', - 'categoria_casa_legislativa', name='detalhes_categoria_casa_legislativa'), + diagnosticos_views.categoria_casa_legislativa, + name='detalhes_categoria_casa_legislativa'), # Detalhes da Categoria de Contatos url(r'^mobile/(?P\d+)/categorias/2/$', - 'categoria_contatos', name='detalhes_categoria_contatos'), + diagnosticos_views.categoria_contatos, + name='detalhes_categoria_contatos'), # Detalhes de Categorias Dinamicas url(r'^mobile/(?P\d+)/categorias/(?P\d+)/$', - 'categoria_detalhes', name='detalhes_categoria'), + diagnosticos_views.categoria_detalhes, name='detalhes_categoria'), - url(r'^mapa/$', TemplateView.as_view(template_name="diagnosticos/mapa.html"), name='template-mapa'), - url(r'^mundiagjson/$', 'municipios_diagnosticados', name='municipios-diagnosticados'), + url(r'^mapa/$', + TemplateView.as_view(template_name="diagnosticos/mapa.html"), + name='template-mapa'), + url(r'^mundiagjson/$', diagnosticos_views.municipios_diagnosticados, + name='municipios-diagnosticados'), # Reports diagnosticos - url(r'^diagnostico/(?P\w+).pdf$', 'diagnostico_pdf', name='diagnostico-pdf'), + url(r'^diagnostico/(?P\w+).pdf$', + diagnosticos_views.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', + url(r'^graficos/$', diagnosticos_views.graficos, + name="diagnosticos-graficos"), # tagerror + url(r'^api/$', diagnosticos_views.grafico_api, + name="diagnosticos-grafico-api"), # tagerror +] +urlpatterns += [ # Login do Diagnóstico - url(r'^mobile/login/$', 'login', {'template_name': - 'diagnosticos/diagnosticos_login.html'}, name='login'), + url(r'^mobile/login/$', + auth_views.login, {'template_name': + 'diagnosticos/diagnosticos_login.html'}, + name='login'), # Logout do Diagnóstico - url(r'^mobile/logout/$', 'logout', - {'next_page': LOGIN_REDIRECT_URL}, name='logout'), -) + url(r'^mobile/logout/$', auth_views.logout, + {'next_page': diagnosticos_views.LOGIN_REDIRECT_URL}, name='logout'), +] diff --git a/sigi/apps/diagnosticos/views.py b/sigi/apps/diagnosticos/views.py index 946300d..79725bd 100644 --- a/sigi/apps/diagnosticos/views.py +++ b/sigi/apps/diagnosticos/views.py @@ -15,10 +15,10 @@ from sigi.apps.diagnosticos.forms import (CasaLegislativaMobileForm, DiagnosticoMobileForm, FuncionariosMobileForm) from sigi.apps.diagnosticos.models import Categoria, Diagnostico, Pergunta -from sigi.apps.diagnosticos.urls import LOGIN_REDIRECT_URL from sigi.apps.utils.decorators import login_required from sigi.shortcuts import render_to_pdf +LOGIN_REDIRECT_URL = '/diagnosticos/mobile/login' @never_cache @login_required(login_url=LOGIN_REDIRECT_URL) diff --git a/sigi/apps/eventos/urls.py b/sigi/apps/eventos/urls.py index 9967641..327eba6 100644 --- a/sigi/apps/eventos/urls.py +++ b/sigi/apps/eventos/urls.py @@ -1,9 +1,9 @@ # coding: utf-8 -from django.conf.urls import patterns, url +from django.conf.urls import url +from sigi.apps.eventos import views -urlpatterns = patterns( - 'sigi.apps.eventos.views', +urlpatterns = [ # Painel de ocorrencias - url(r'^calendario/$', 'calendario', name='eventos-calendario'), - url(r'^alocacaoequipe/$', 'alocacao_equipe', name='eventos-alocacaoequipe'), -) + url(r'^calendario/$', views.calendario, name='eventos-calendario'), + url(r'^alocacaoequipe/$', views.alocacao_equipe, name='eventos-alocacaoequipe'), +] diff --git a/sigi/apps/home/urls.py b/sigi/apps/home/urls.py index 1cf329a..3c28ec9 100644 --- a/sigi/apps/home/urls.py +++ b/sigi/apps/home/urls.py @@ -1,22 +1,22 @@ # coding: utf-8 from django.conf.urls import patterns, url from django.views.generic.base import TemplateView +from sigi.apps.home import views -urlpatterns = patterns( - 'sigi.apps.home.views', +urlpatterns = [ url(r'^atendimento', TemplateView.as_view( template_name='index_atendimento.html'), name='index_atendimento'), - url(r'^$', 'index', name='sigi_index'), - url(r'^home/resumoconvenios/$', 'resumo_convenios', + url(r'^$', views.index, name='sigi_index'), + url(r'^home/resumoconvenios/$', views.resumo_convenios, name="home_resumoconvenios"), - url(r'^home/resumoseit/$', 'resumo_seit', name="home_resumoseit"), - url(r'^home/chartseit/$', 'chart_seit', name="home_chartseit"), - url(r'^home/chartconvenios/$', 'chart_convenios', + url(r'^home/resumoseit/$', views.resumo_seit, name="home_resumoseit"), + url(r'^home/chartseit/$', views.chart_seit, name="home_chartseit"), + url(r'^home/chartconvenios/$', views.chart_convenios, name="home_chartconvenios"), - url(r'^home/chartcarteira/$', 'chart_carteira', name="home_chartcarteira"), - url(r'^home/chartperformance/$', 'chart_performance', + url(r'^home/chartcarteira/$', views.chart_carteira, name="home_chartcarteira"), + url(r'^home/chartperformance/$', views.chart_performance, name="home_chartperformance"), - url(r'^home/report/semconvenio/$', 'report_sem_convenio', + url(r'^home/report/semconvenio/$', views.report_sem_convenio, name="home_reportsemconvenio"), -) +] diff --git a/sigi/apps/mdl/models.py b/sigi/apps/mdl/models.py index 0e22936..6e14c8c 100644 --- a/sigi/apps/mdl/models.py +++ b/sigi/apps/mdl/models.py @@ -40,7 +40,7 @@ class CourseStats(models.Model): ('A', u'Aprovação'), ('I', u'Indeterminado'),) - category = models.ForeignKey('CourseCategories', db_column='categoryid', primary_key=True) + category = models.ForeignKey('CourseCategories', db_column='categoryid') course = models.ForeignKey('Course', db_column='courseid') completionstatus = models.CharField(max_length=1, choices=COMPLETIONSTATUS_CHOICES) usercount = models.IntegerField() diff --git a/sigi/apps/metas/urls.py b/sigi/apps/metas/urls.py index 7c7dad4..eda366c 100644 --- a/sigi/apps/metas/urls.py +++ b/sigi/apps/metas/urls.py @@ -1,13 +1,13 @@ # coding: utf-8 -from django.conf.urls import patterns, url +from django.conf.urls import url +from sigi.apps.metas import views -urlpatterns = patterns( - 'sigi.apps.metas.views', - url(r'^$', 'dashboard', name='metas-dashboardsss'), # tagerror - url(r'^mapa/$', 'mapa', name='metas-mapa'), # tagerror - url(r'^mapdata/$', 'map_data', name='metas-map_data'), - url(r'^mapsearch/$', 'map_search', name='metas-map_search'), - url(r'^mapsum/$', 'map_sum', name='metas-map_sum'), - url(r'^maplist/$', 'map_list', name='metas-map_list'), -) +urlpatterns = [ + url(r'^$', views.dashboard, name='metas-dashboardsss'), # tagerror + url(r'^mapa/$', views.mapa, name='metas-mapa'), # tagerror + url(r'^mapdata/$', views.map_data, name='metas-map_data'), + url(r'^mapsearch/$', views.map_search, name='metas-map_search'), + url(r'^mapsum/$', views.map_sum, name='metas-map_sum'), + url(r'^maplist/$', views.map_list, name='metas-map_list'), +] diff --git a/sigi/apps/ocorrencias/urls.py b/sigi/apps/ocorrencias/urls.py index c6c8257..536117b 100644 --- a/sigi/apps/ocorrencias/urls.py +++ b/sigi/apps/ocorrencias/urls.py @@ -1,18 +1,18 @@ # coding: utf-8 from django.conf.urls import patterns, url +from sigi.apps.ocorrencias import views -urlpatterns = patterns( - 'sigi.apps.ocorrencias.views', +urlpatterns = [ # Painel de ocorrencias - url(r'^painel/$', 'painel_ocorrencias', name='painel-ocorrencias'), - url(r'^painel/buscanominal/$', 'busca_nominal', {"origin": "tudo"}, name='painel-buscanominal'), - url(r'^painel/buscanominal/casa/$', 'busca_nominal', {"origin": "casa"}, name='painel-buscacasa'), - url(r'^painel/buscanominal/servidor/$', 'busca_nominal', {"origin": "servidor"}, name='painel-buscaservidor'), - url(r'^painel/buscanominal/servico/$', 'busca_nominal', {"origin": "servico"}, name='painel-buscaservico'), - url(r'^mudaprioridade/$', 'muda_prioridade', name='ocorrencia-mudaprioridade'), - url(r'^excluianexo/$', 'exclui_anexo', name='ocorrencia-excluianexo'), - url(r'^incluianexo/$', 'inclui_anexo', name='ocorrencia-incluianexo'), - url(r'^anexosnippet/$', 'anexo_snippet', name='ocorrencia-anexosnippet'), - url(r'^incluicomentario/$', 'inclui_comentario', name='ocorrencia-incluicomentario'), - url(r'^incluiocorrencia/$', 'inclui_ocorrencia', name='ocorrencia-incluiocorrencia'), -) + url(r'^painel/$', views.painel_ocorrencias, name='painel-ocorrencias'), + url(r'^painel/buscanominal/$', views.busca_nominal, {"origin": "tudo"}, name='painel-buscanominal'), + url(r'^painel/buscanominal/casa/$', views.busca_nominal, {"origin": "casa"}, name='painel-buscacasa'), + url(r'^painel/buscanominal/servidor/$', views.busca_nominal, {"origin": "servidor"}, name='painel-buscaservidor'), + url(r'^painel/buscanominal/servico/$', views.busca_nominal, {"origin": "servico"}, name='painel-buscaservico'), + url(r'^mudaprioridade/$', views.muda_prioridade, name='ocorrencia-mudaprioridade'), + url(r'^excluianexo/$', views.exclui_anexo, name='ocorrencia-excluianexo'), + url(r'^incluianexo/$', views.inclui_anexo, name='ocorrencia-incluianexo'), + url(r'^anexosnippet/$', views.anexo_snippet, name='ocorrencia-anexosnippet'), + url(r'^incluicomentario/$', views.inclui_comentario, name='ocorrencia-incluicomentario'), + url(r'^incluiocorrencia/$', views.inclui_ocorrencia, name='ocorrencia-incluiocorrencia'), +] diff --git a/sigi/apps/parlamentares/urls.py b/sigi/apps/parlamentares/urls.py index 395ef31..278706b 100644 --- a/sigi/apps/parlamentares/urls.py +++ b/sigi/apps/parlamentares/urls.py @@ -1,17 +1,16 @@ # coding: utf-8 -from django.conf.urls import patterns, url - -urlpatterns = patterns( - 'sigi.apps.parlamentares.views', +from django.conf.urls import url +from sigi.apps.parlamentares import views +urlpatterns = [ # Reports labels parlamentares - url(r'^parlamentar/labels/$', 'labels_report', name='labels-report-all'), - url(r'^parlamentar/(?P\w+)/labels/$', 'labels_report', name='labels-report-id'), + url(r'^parlamentar/labels/$', views.labels_report, name='labels-report-all'), + url(r'^parlamentar/(?P\w+)/labels/$', views.labels_report, name='labels-report-id'), # Carrinho - url(r'^parlamentar/carrinho/$', 'visualizar_carrinho', name='visualizar-carrinho'), - url(r'^parlamentar/carrinho/deleta_itens_carrinho$', 'deleta_itens_carrinho', name='deleta-itens-carrinho'), + url(r'^parlamentar/carrinho/$', views.visualizar_carrinho, name='visualizar-carrinho'), + url(r'^parlamentar/carrinho/deleta_itens_carrinho$', views.deleta_itens_carrinho, name='deleta-itens-carrinho'), # A view excluir_carrinho n existe ainda. - # url(r'^parlamentar/carrinho/exluir_carrinho$', 'excluir_carrinho', name='excluir-carrinho'), -) + # url(r'^parlamentar/carrinho/exluir_carrinho$', views.excluir_carrinho, name='excluir-carrinho'), +] diff --git a/sigi/apps/saberes/urls.py b/sigi/apps/saberes/urls.py index 7a6d1bc..53c24b8 100644 --- a/sigi/apps/saberes/urls.py +++ b/sigi/apps/saberes/urls.py @@ -1,14 +1,11 @@ # coding: utf-8 -from django.conf.urls import patterns, url +from django.conf.urls import url +from sigi.apps.saberes import views -from .views import (cursos_com_tutoria, cursos_sem_tutoria, dashboard, - pentaho_proxy) -urlpatterns = patterns( - 'sigi.apps.saberes.views', - - url(r'^dashboard/cursos-sem-turoria/?$', cursos_sem_tutoria, name="saberes-cursos-sem-tutoria"), - url(r'^dashboard/cursos-com-turoria/?$', cursos_com_tutoria, name="saberes-cursos-com-tutoria"), - url(r'^dashboard/?$', dashboard, name="saberes-dashboard-view"), - url(r'^(?P(plugin|api)/.*)$', pentaho_proxy), -) +urlpatterns = [ + url(r'^dashboard/cursos-sem-turoria/?$', views.cursos_sem_tutoria, name="saberes-cursos-sem-tutoria"), + url(r'^dashboard/cursos-com-turoria/?$', views.cursos_com_tutoria, name="saberes-cursos-com-tutoria"), + url(r'^dashboard/?$', views.dashboard, name="saberes-dashboard-view"), + url(r'^(?P(plugin|api)/.*)$', views.pentaho_proxy), +] diff --git a/sigi/apps/servicos/migrations/0005_auto_20160912_1503.py b/sigi/apps/servicos/migrations/0005_auto_20160912_1503.py new file mode 100644 index 0000000..e25f681 --- /dev/null +++ b/sigi/apps/servicos/migrations/0005_auto_20160912_1503.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-09-12 15:03 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('servicos', '0004_auto_20160623_0829'), + ] + + operations = [ + migrations.AlterField( + model_name='casamanifesta', + name='casa_legislativa', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='casas.CasaLegislativa'), + ), + ] diff --git a/sigi/apps/servicos/models.py b/sigi/apps/servicos/models.py index 8eeee00..d7db14c 100644 --- a/sigi/apps/servicos/models.py +++ b/sigi/apps/servicos/models.py @@ -195,7 +195,7 @@ class CasaAtendida(CasaLegislativa): class CasaManifesta(models.Model): - casa_legislativa = models.OneToOneField(CasaLegislativa) + casa_legislativa = models.ForeignKey(CasaLegislativa) data_manifestacao = models.DateTimeField(auto_now_add=True) data_atualizacao = models.DateTimeField(auto_now=True) informante = models.CharField(_(u'Nome do informante'), max_length=100, blank=True) diff --git a/sigi/apps/servicos/urls.py b/sigi/apps/servicos/urls.py index 22f9e9f..b050297 100644 --- a/sigi/apps/servicos/urls.py +++ b/sigi/apps/servicos/urls.py @@ -1,14 +1,14 @@ # coding: utf-8 -from django.conf.urls import patterns, url +from django.conf.urls import url from django.views.generic.base import TemplateView from .views import MapaView +from sigi.apps.servicos import views -urlpatterns = patterns( - 'sigi.apps.servicos.views', - url(r'^manifesta/$', 'casa_manifesta_view', name="casa-manifesta-view"), - url(r'^munatenjson/(?P\w+)/$', 'municipios_atendidos', name="municipios-atendidos"), +urlpatterns = [ + url(r'^manifesta/$', views.casa_manifesta_view, name="casa-manifesta-view"), + url(r'^munatenjson/(?P\w+)/$', views.municipios_atendidos, name="municipios-atendidos"), url(r'^mapa/(?P\w+)/$', MapaView.as_view(), name="servicos-mapa"), - # url(r'^listacasas/(?P\w+)', 'casas_usam_servico', name="casas-usam-servico"), -) + # url(r'^listacasas/(?P\w+)', views.casas_usam_servico, name="casas-usam-servico"), +] diff --git a/sigi/apps/servidores/migrations/0004_auto_20160912_1503.py b/sigi/apps/servidores/migrations/0004_auto_20160912_1503.py new file mode 100644 index 0000000..c01ad6a --- /dev/null +++ b/sigi/apps/servidores/migrations/0004_auto_20160912_1503.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-09-12 15:03 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('servidores', '0003_auto_20160811_1553'), + ] + + operations = [ + migrations.AlterField( + model_name='servidor', + name='user', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/sigi/apps/servidores/models.py b/sigi/apps/servidores/models.py index e835815..6b64940 100644 --- a/sigi/apps/servidores/models.py +++ b/sigi/apps/servidores/models.py @@ -63,7 +63,7 @@ class Servidor(models.Model): ) # usuario responsavel pela autenticação do servidor no sistema - user = models.ForeignKey(User, unique=True) + user = models.OneToOneField(User) nome_completo = models.CharField(max_length=128) apelido = models.CharField(max_length=50, blank=True) # caminho no sistema para arquivo com a imagem diff --git a/sigi/apps/servidores/urls.py b/sigi/apps/servidores/urls.py index 60c122d..93539bf 100644 --- a/sigi/apps/servidores/urls.py +++ b/sigi/apps/servidores/urls.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- -from django.conf.urls import patterns, url - -urlpatterns = patterns( - 'sigi.apps.servidores.views', +from django.conf.urls import url +from sigi.apps.servidores import views +urlpatterns = [ # Reports servidores - url(r'^servidores_por_funcao.pdf$', 'servidores_por_funcao', name='servidores-funcao-pdf'), - url(r'^servidores_por_cargo.pdf$', 'servidores_por_cargo', name='servidores-cargo-pdf'), -) + url(r'^servidores_por_funcao.pdf$', views.servidores_por_funcao, name='servidores-funcao-pdf'), + url(r'^servidores_por_cargo.pdf$', views.servidores_por_cargo, name='servidores-cargo-pdf'), +] diff --git a/sigi/settings/base.py b/sigi/settings/base.py index 0f212d1..de57184 100644 --- a/sigi/settings/base.py +++ b/sigi/settings/base.py @@ -31,16 +31,6 @@ MANAGERS = ADMINS SITE_ID = 1 -TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + [ - 'django.core.context_processors.request', - 'sigi.context_processors.usuario_context' -] - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - ) - # Database routers DATABASE_ROUTERS = ['moodlerouter.MoodleRouter', ] @@ -137,9 +127,30 @@ SERVER_EMAIL = 'sigi@interlegis.leg.br' DEFAULT_FROM_EMAIL = 'spdt@interlegis.leg.br' EMAIL_SUBJECT_PREFIX = u'[SIGI]' -TEMPLATE_DIRS = ( - os.path.join(BASE_DIR, 'templates'), -) +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.template.context_processors.debug', + 'django.template.context_processors.i18n', + 'django.template.context_processors.media', + 'django.template.context_processors.static', + 'django.template.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + 'sigi.context_processors.usuario_context' + ], + 'loaders': [ + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + ] + }, + }, +] + MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' diff --git a/sigi/settings/dev.py b/sigi/settings/dev.py index d400545..6f7e472 100644 --- a/sigi/settings/dev.py +++ b/sigi/settings/dev.py @@ -19,7 +19,6 @@ DATABASES = { # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -TEMPLATE_DEBUG = DEBUG DEBUG_TOOLBAR_CONFIG = { 'SHOW_TEMPLATE_CONTEXT': True, } diff --git a/sigi/urls.py b/sigi/urls.py index ea67a57..3552057 100644 --- a/sigi/urls.py +++ b/sigi/urls.py @@ -5,15 +5,14 @@ from django.conf.urls import include, patterns, url from django.conf.urls.static import static from django.contrib import admin from django.views.generic.base import TemplateView +from django.views.static import serve from sigi.apps.saberes.views import pentaho_proxy admin.site.index_template = 'index.html' admin.autodiscover() -urlpatterns = patterns( - '', - +urlpatterns = [ url(r'^parlamentares/', include('sigi.apps.parlamentares.urls')), url(r'^casas/', include('sigi.apps.casas.urls')), url(r'^convenios/', include('sigi.apps.convenios.urls')), @@ -38,15 +37,13 @@ urlpatterns = patterns( # Suspended # url(r'^i18n/', include('django.conf.urls.i18n')), -) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) +] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) if settings.DEBUG: - urlpatterns = patterns( - '', - + urlpatterns = [ 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')), - url(r'^media/(?P.*)$', 'django.views.static.serve', { + url(r'^media/(?P.*)$', serve, { 'document_root': settings.MEDIA_ROOT, }), - ) + urlpatterns + ] + urlpatterns