diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-08-16 18:04:52 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-08-16 18:04:52 +0200 |
commit | 382ca07f8c08075d296f943f9408e7d8cdbf4d21 (patch) | |
tree | cb0ec4e91717577b0521d0c0cfc17b7ca2d68a65 | |
parent | 49e0c676d0673111ed35783af6cf66803e034665 (diff) | |
download | Ishtar-382ca07f8c08075d296f943f9408e7d8cdbf4d21.tar.bz2 Ishtar-382ca07f8c08075d296f943f9408e7d8cdbf4d21.zip |
Docs: display weblink in source tables (refs #3081)
-rw-r--r-- | ishtar_common/models.py | 3 | ||||
-rw-r--r-- | ishtar_common/views.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index a4d7f70d9..02fbe05b9 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2463,7 +2463,8 @@ class Source(models.Model): additional_information = models.TextField(_(u"Additional information"), blank=True, null=True) duplicate = models.BooleanField(_(u"Has a duplicate"), default=False) - TABLE_COLS = ['title', 'source_type', 'authors', ] + TABLE_COLS = ['title', 'source_type', 'authors', 'associated_url'] + COL_LINK = ['associated_url'] class Meta: abstract = True diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 01811ed2d..d89e35bee 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -689,6 +689,7 @@ def get_item(model, func_name, default_name, extra_request_keys=[], link_template = "<a class='display_details' href='#' "\ "onclick='load_window(\"%s\")'>"\ "<i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i></a>" + link_ext_template = '<a href="{}" target="_blank">{}</a>' if data_type == "json": rows = [] for data in datas: @@ -715,6 +716,8 @@ def get_item(model, func_name, default_name, extra_request_keys=[], else: tab_cols.append(tc) k = "__".join(tab_cols) + if hasattr(model, 'COL_LINK') and k in model.COL_LINK: + value = link_ext_template.format(value, value) res[k] = value rows.append(res) data = json.dumps({ |