Browse Source

Trata inexist de arq template passado p menus.py

pull/760/head
LeandroRoberto 8 years ago
parent
commit
0bdd52543e
  1. 24
      sapl/base/apps.py
  2. 9
      sapl/base/templatetags/menus.py
  3. 1
      sapl/crud/base.py

24
sapl/base/apps.py

@ -102,35 +102,13 @@ def create_proxy_permissions(
print("Adding permission '%s'" % perm)
def run_sql_organizers(
app_config, verbosity=2, interactive=True,
using=DEFAULT_DB_ALIAS, **kwargs):
"""with connection.cursor() as cursor:
for line in lines:
line = line.strip()
if not line or line.startswith('#'):
continue
try:
cursor.execute(line)"""
print('aqui run_sql_organizer', app_config)
""" update protocoloadm_protocolo set autor_id = null;
delete from materia_autoria;
delete from materia_proposicao;
delete from materia_tipoproposicao;
"""
class AppConfig(django.apps.AppConfig):
name = 'sapl.base'
label = 'base'
verbose_name = _('Dados Básicos')
def ready(self):
pre_migrate.connect(run_sql_organizers, self)
#pre_migrate.connect(run_sql_organizers, self)
post_migrate.connect(
receiver=create_proxy_permissions,

9
sapl/base/templatetags/menus.py

@ -1,10 +1,11 @@
import yaml
from django import template
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
import yaml
from sapl.utils import sapl_logger
register = template.Library()
@ -55,14 +56,18 @@ def subnav(context, path=None):
if not yaml_path:
return
try:
"""
Por padrão, são carragados dois Loaders,
filesystem.Loader - busca em TEMPLATE_DIRS do projeto atual
app_directories.Loader - busca em todas apps instaladas
A função nativa abaixo busca em todos os Loaders Configurados.
"""
try:
yaml_template = template.loader.get_template(yaml_path)
except:
return
try:
rendered = yaml_template.render()
menu = yaml.load(rendered)
resolve_urls_inplace(menu, root_pk, rm, context)

1
sapl/crud/base.py

@ -1164,6 +1164,7 @@ class MasterDetailCrud(Crud):
return context
@property
def cancel_url(self):
if self.list_url:
return self.list_url

Loading…
Cancel
Save