diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py
index 048778d8d..56d7d356e 100644
--- a/sapl/base/templatetags/common_tags.py
+++ b/sapl/base/templatetags/common_tags.py
@@ -51,6 +51,13 @@ def model_verbose_name_plural(class_name):
model = get_class(class_name)
return model._meta.verbose_name_plural
+@register.filter
+def meta_model_value(instance, attr):
+ try:
+ return getattr(instance._meta, attr)
+ except:
+ return ''
+
@register.filter
def split(value, arg):
@@ -324,12 +331,12 @@ def render_chunk_vendors(extension=None):
return mark_safe('\n'.join(tags))
except:
return ''
-
-
+
+
@register.filter(is_safe=True)
-@stringfilter
+@stringfilter
def dont_break_out(value):
_safe = '
{}
'.format(value)
_safe = mark_safe(_safe)
- return _safe
+ return _safe
diff --git a/sapl/norma/views.py b/sapl/norma/views.py
index 1281f9d76..6173ab832 100644
--- a/sapl/norma/views.py
+++ b/sapl/norma/views.py
@@ -7,6 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.http import HttpResponse, JsonResponse
from django.http.response import HttpResponseRedirect
+from django.shortcuts import redirect
from django.template import RequestContext, loader
from django.urls import reverse
from django.urls.base import reverse_lazy
@@ -35,8 +36,6 @@ from .models import (AnexoNormaJuridica, AssuntoNorma, NormaJuridica, NormaRelac
# LegislacaoCitadaCrud = Crud.build(LegislacaoCitada, '')
-
-
TipoNormaCrud = CrudAux.build(
TipoNormaJuridica, 'tipo_norma_juridica',
list_field_names=['sigla', 'descricao', 'equivalente_lexml'])
@@ -273,6 +272,11 @@ class NormaCrud(Crud):
norma_id=kwargs['pk'],
ano=timezone.now().year,
horario_acesso=timezone.now())
+
+ if not 'display' in request.GET and not request.user.has_perm('norma.change_normajuridica') and \
+ self.get_object().texto_articulado.exists():
+ return redirect(reverse('sapl.norma:norma_ta',
+ kwargs={'pk': self.kwargs['pk']}))
return super().get(request, *args, **kwargs)
class DeleteView(Crud.DeleteView):
diff --git a/sapl/templates/base.html b/sapl/templates/base.html
index 7bf3975ef..e027a5e29 100644
--- a/sapl/templates/base.html
+++ b/sapl/templates/base.html
@@ -66,7 +66,7 @@