From: Radek Czajka Date: Tue, 12 Nov 2024 10:58:08 +0000 (+0100) Subject: Obey length limits for wikidata import. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/491078616e2129745f300c1f0357f5bac52e801d?hp=1c013c31745b335962a07057f962e47212faf80f Obey length limits for wikidata import. --- diff --git a/src/catalogue/wikidata.py b/src/catalogue/wikidata.py index b5ce07b1..84f899ac 100644 --- a/src/catalogue/wikidata.py +++ b/src/catalogue/wikidata.py @@ -164,6 +164,9 @@ class WikidataModel(models.Model): 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):