Obey length limits for wikidata import.
[redakcja.git] / src / catalogue / wikidata.py
index b5ce07b..84f899a 100644 (file)
@@ -164,6 +164,9 @@ class WikidataModel(models.Model):
                 except:
                     pass
                 else:
                 except:
                     pass
                 else:
+                    max_length = getattr(model_field, 'max_length', None)
+                    if max_length:
+                        wdvalue = wdvalue[:max_length]
                     setattr(self, attname, wdvalue)
 
     def wikidata_link(self):
                     setattr(self, attname, wdvalue)
 
     def wikidata_link(self):