From 9b533fdbfd08bd764744ae3a0d4717c87b61cf18 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 12 Nov 2024 12:01:43 +0100 Subject: [PATCH 1/1] Fix. --- src/catalogue/wikidata.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/catalogue/wikidata.py b/src/catalogue/wikidata.py index 84f899ac..731e55f2 100644 --- a/src/catalogue/wikidata.py +++ b/src/catalogue/wikidata.py @@ -164,9 +164,10 @@ class WikidataModel(models.Model): except: pass else: - max_length = getattr(model_field, 'max_length', None) - if max_length: - wdvalue = wdvalue[:max_length] + if isinstance(wdvalue, str): + max_length = getattr(model_field, 'max_length', None) + if max_length: + wdvalue = wdvalue[:max_length] setattr(self, attname, wdvalue) def wikidata_link(self): -- 2.20.1