From 9d2bc13420283d11b43715fc51fd8eb5a13c15a2 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Mon, 14 Mar 2016 17:12:11 -0300 Subject: [PATCH] =?UTF-8?q?Conserta=20bug=20na=20gera=C3=A7=C3=A3o=20de=20?= =?UTF-8?q?relat=C3=B3rio=20com=20UF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/urls.py | 6 ++++++ relatorios/views.py | 3 ++- sapl/utils.py | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/base/urls.py b/base/urls.py index 47f66718f..e77cd643d 100644 --- a/base/urls.py +++ b/base/urls.py @@ -1,6 +1,8 @@ from django.conf.urls import url from django.views.generic.base import TemplateView +from django.contrib.staticfiles.urls import staticfiles_urlpatterns + from .views import CasaLegislativaTableAuxView, HelpView urlpatterns = [ @@ -11,3 +13,7 @@ urlpatterns = [ url(r'^casa-legislativa$', CasaLegislativaTableAuxView.as_view(), name='casa_legislativa'), ] + +# Fix a static asset finding error on Django 1.9 + gunicorn: +# http://stackoverflow.com/questions/35510373/ +urlpatterns += staticfiles_urlpatterns() diff --git a/relatorios/views.py b/relatorios/views.py index fa0e3b932..b11813364 100644 --- a/relatorios/views.py +++ b/relatorios/views.py @@ -42,7 +42,8 @@ def get_cabecalho(casa): cabecalho = {} cabecalho["nom_casa"] = casa.nome # FIXME i18n - cabecalho["nom_estado"] = "Estado de " + UF[casa.uf.upper()] + uf_dic = dict(UF) + cabecalho["nom_estado"] = "Estado de " + uf_dic[casa.uf.upper()] return cabecalho diff --git a/sapl/utils.py b/sapl/utils.py index bfa821802..f5707d197 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -87,7 +87,7 @@ def listify(function): return list(function(*args, **kwargs)) return f -UF = ( +UF = [ ('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), @@ -116,6 +116,6 @@ UF = ( ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior'), - ) + ] RANGE_ANOS = [(year, year) for year in range(date.today().year, 1889, -1)]