From: Radek Czajka Date: Tue, 12 Nov 2024 11:01:43 +0000 (+0100) Subject: Fix. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/HEAD?ds=inline;hp=491078616e2129745f300c1f0357f5bac52e801d Fix. --- 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):