From 935dff1add4bbe929ea731e78e48b0238a18e53a Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Wed, 5 Oct 2016 10:27:34 -0300 Subject: [PATCH] Cria forma provisoria para colocar links nas URLs nas telas de detail --- sapl/base/templatetags/common_tags.py | 9 +++++++++ sapl/templates/crud/detail.html | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py index 86205cef2..57f6e9f81 100644 --- a/sapl/base/templatetags/common_tags.py +++ b/sapl/base/templatetags/common_tags.py @@ -140,3 +140,12 @@ def str2intabs(value): return v except: return '' + + +@register.filter +def url(value): + # import ipdb; ipdb.set_trace() + string = value[:8] + if 'http://' in string or 'https://' in string: + return True + return False diff --git a/sapl/templates/crud/detail.html b/sapl/templates/crud/detail.html index e5d9c0ffc..1eab8100c 100644 --- a/sapl/templates/crud/detail.html +++ b/sapl/templates/crud/detail.html @@ -38,7 +38,12 @@

{{ column.verbose_name }}

-
{{ column.text|safe }}
+ + {% if column.text|url %} + + {% else %} +
{{ column.text|safe }}
+ {% endif %}