Closed kiyoshi-satoo closed 1 year ago
The error is clear in the fact that your model (FontLicence
) must inherit from TranslatableMixin
. The wagtail-localize docs (and the Wagtail docs) also ask that your custom model inherit from TranslatableMixin
in order for the translation mechanisms to work
Thanks for the answer @zerolab . I have changed the code. But now I am getting error in migrate.I noticed that this happens when applying migrations to existing models.Are there any solutions for applying migrations on existing data ?
class FontLicence(TranslatableMixin,ClusterableModel):
name = models.CharField(max_length=255, verbose_name="Licence", unique=True)
class Meta:
unique_together = ('translation_key', 'locale')
def __str__(self):
return f'{self.name}'
UNIQUE constraint failed: font_fontlicence.translation_key, font_fontlicence.locale_id
This happens because you already have content. See https://docs.wagtail.org/en/stable/advanced_topics/i18n.html#making-snippets-with-existing-data-translatable for steps on how to adress this.
@zerolab Thanks, it's working. Didn't notice it in the documentation :)