diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-07-05 23:36:34 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-07-05 23:36:34 +0200 | 
| commit | cfe916133f341f6e8470a91c1151eab8233dd3ab (patch) | |
| tree | 1b01ac16d72ab8d43d1d7554aee5f1306f987ec7 | |
| parent | e6c9c807038834d6eb673acfa7d12bcd968e2de8 (diff) | |
| download | Ishtar-cfe916133f341f6e8470a91c1151eab8233dd3ab.tar.bz2 Ishtar-cfe916133f341f6e8470a91c1151eab8233dd3ab.zip | |
Template tags: fix field url with empty url
| -rw-r--r-- | ishtar_common/templates/ishtar/sheet_source.html | 4 | ||||
| -rw-r--r-- | ishtar_common/templatetags/window_field.py | 6 | 
2 files changed, 4 insertions, 6 deletions
| diff --git a/ishtar_common/templates/ishtar/sheet_source.html b/ishtar_common/templates/ishtar/sheet_source.html index 244ca1be3..24477ce2c 100644 --- a/ishtar_common/templates/ishtar/sheet_source.html +++ b/ishtar_common/templates/ishtar/sheet_source.html @@ -19,8 +19,8 @@  {% field_li "Source type" item.source_type %}  {% field_li "Format type" item.format_type %}  {% field_li "Scale" item.scale %} -    {% trans "Web link" as weblink_label %} -    {% field_li_url weblink_label item.associated_url %} +{% trans "Web link" as weblink_label %} +{% field_li_url weblink_label item.associated_url %}  {% field_li "Item number" item.item_number %}  {% field_li "Ref." item.reference %}  {% field_li "Internal ref." item.internal_reference %} diff --git a/ishtar_common/templatetags/window_field.py b/ishtar_common/templatetags/window_field.py index 5180955d8..022986493 100644 --- a/ishtar_common/templatetags/window_field.py +++ b/ishtar_common/templatetags/window_field.py @@ -25,10 +25,8 @@ def field_li(caption, data, pre_data='', post_data=''):  def field_url(caption, link, link_name='', li=False):      if link:          link = link.strip() -    if not link: -        return u'' -    if not link.startswith('http://') and not link.startswith('https://'): -        link = 'http://' + link +        if not link.startswith('http://') and not link.startswith('https://'): +            link = 'http://' + link      return {'caption': caption, 'link': link, "link_name": link_name, 'li': li} | 
