Fix.
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 12 Nov 2024 11:01:43 +0000 (12:01 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 12 Nov 2024 11:01:43 +0000 (12:01 +0100)
src/catalogue/wikidata.py

index 84f899a..731e55f 100644 (file)
@@ -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):