diff --git a/apis_core/apis_entities/templates/apis_entities/detail_views/entity_detail_generic.html b/apis_core/apis_entities/templates/apis_entities/detail_views/entity_detail_generic.html
index d2e5a1b..8e7df0e 100644
--- a/apis_core/apis_entities/templates/apis_entities/detail_views/entity_detail_generic.html
+++ b/apis_core/apis_entities/templates/apis_entities/detail_views/entity_detail_generic.html
@@ -63,7 +63,7 @@
diff --git a/apis_core/apis_entities/tests.py b/apis_core/apis_entities/tests.py
index cc1a1ac..1f34cf0 100644
--- a/apis_core/apis_entities/tests.py
+++ b/apis_core/apis_entities/tests.py
@@ -366,8 +366,10 @@ def test_026_fetch_image(self):
entity = import_from_normdata(grillparzer, "person")
entity.fetch_image()
self.assertTrue(entity.img_url)
- self.assertTrue("Wikimedia Commons" in entity.img_credit())
+ self.assertTrue("Wikimedia Commons" in entity.img_credit_label())
+ self.assertTrue("File:" in entity.img_credit())
def test_027_img_credit(self):
entity = import_from_normdata("https://www.wikidata.org/wiki/Q76483", "person")
self.assertIsNone(entity.img_credit())
+ self.assertIsNone(entity.img_credit_label())
diff --git a/apis_core/apis_metainfo/models.py b/apis_core/apis_metainfo/models.py
index ef19c6c..d43ac6c 100644
--- a/apis_core/apis_metainfo/models.py
+++ b/apis_core/apis_metainfo/models.py
@@ -158,8 +158,16 @@ def fetch_image(self):
def img_credit(self):
credit = None
if self.img_url is not None:
+ img_name = self.img_url.split("/")[-1]
if "commons.wikimedia.org/w/index" in self.img_url:
- credit = "Wikimedia Commons"
+ credit = f"https://commons.wikimedia.org/wiki/File:{img_name}"
+ return credit
+
+ def img_credit_label(self):
+ credit = None
+ if self.img_url is not None:
+ if "commons.wikimedia.org/w/index" in self.img_url:
+ return "Wikimedia Commons"
return credit
@classmethod