diff --git a/sapl/context_processors.py b/sapl/context_processors.py index d3dca8e69..29e570794 100644 --- a/sapl/context_processors.py +++ b/sapl/context_processors.py @@ -1,6 +1,15 @@ + +from base.models import CasaLegislativa + + +# TODO: this need to be cached and retrieved once!!! +def query_database(): + return CasaLegislativa.objects.first() + + def parliament_info(request): - return { + context = { 'state': 'Estado', 'state_abbr': 'UF', 'city': 'Cidade', @@ -11,3 +20,13 @@ def parliament_info(request): 'url_portal': '#', 'url_email': '#', } + + casa_legislativa = query_database() + + if casa_legislativa: + context['parliament_type'] = casa_legislativa.nome + context['city'] = casa_legislativa.municipio + context['state'] = casa_legislativa.uf + context['logotipo'] = casa_legislativa.logotipo + + return context; diff --git a/templates/base.html b/templates/base.html index 983aef960..31f9d7858 100644 --- a/templates/base.html +++ b/templates/base.html @@ -117,8 +117,12 @@ {% block main_header %}
-
{# XXX Make better use of translation tags in html blocks ie. actually use the proper blocktrans tag efficiently #}