diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-28 15:22:08 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-28 15:22:08 +0200 |
commit | 4e3fccf862578d2ec8105ad1b3275b2fe8b7f0d2 (patch) | |
tree | 07cc470409c855234c9ed579c4034f5694b265d0 /ishtar_common/utils.py | |
parent | 4b0860cc8e30a4944e64bd7660d96ce7bdd9be8b (diff) | |
download | Ishtar-4e3fccf862578d2ec8105ad1b3275b2fe8b7f0d2.tar.bz2 Ishtar-4e3fccf862578d2ec8105ad1b3275b2fe8b7f0d2.zip |
Welcome image label for site depending on the profile - Site deletion label
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 1c64f7940..94125ddb8 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -255,7 +255,7 @@ def regenerate_all_cached_labels(model): """ When the rule for generating cached label change. Regeneration of all label has to be done. - :param model: model class conecrned + :param model: model class concerned """ for item in model.all(): item.skip_history_when_saving = True @@ -292,6 +292,8 @@ def disable_for_loaddata(signal_handler): def _get_image_link(doc): + from ishtar_common.models import IshtarSiteProfile + # manage missing images if not doc.thumbnail or not doc.thumbnail.url or not doc.image \ or not doc.image.url: @@ -307,6 +309,11 @@ def _get_image_link(doc): # image attached to nothing... return "" + item_class_name = unicode(item.__class__._meta.verbose_name) + + if item.__class__.__name__ == "ArchaeologicalSite": + item_class_name = unicode(IshtarSiteProfile.get_default_site_label()) + return mark_safe(u""" <div class="col col-lg-3"> <div class="card"> @@ -332,7 +339,7 @@ def _get_image_link(doc): </script>""".format( doc.image.url, doc.thumbnail.url, - unicode(item.__class__._meta.verbose_name), + item_class_name, unicode(item), reverse(item.SHOW_URL, args=[item.pk, '']), unicode(_(u"Information")), |