You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm running Wagtail 5.0 and wagtail-localize 1.6 and I'm getting an issue when adding translation to current models
I followed the tutorial up to the part where we translate content. I create a new migration where Wagtail suggests me to create a unique_together constraint. I do so but it still remains.
$ ./manage.py makemigrations
ERRORS:
portfolio.ProjectCategoryName: (wagtailcore.E003) portfolio.ProjectCategoryName is missing a unique_together constraint for the translation key and locale field
HINT: Add ('translation_key', 'locale') to ProjectCategoryName.Meta.unique_together
It then asks me for a default. I use the first locale ID
$ ./manage.py makemigrations portfolio
It is impossible to add a non-nullable field 'locale' to projectcategoryname without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Quit and manually define a default value in models.py.
Select an option: 1
>>> 1
Then it breaks when I'm migrating
django.db.utils.IntegrityError: could not create unique index "portfolio_projectcategor_translation_key_locale_i_77fbe046_uniq"
DETAIL: Key (translation_key, locale_id)=(cd19e8c3-81be-4da7-8a45-c78cb26c69e1, 1) is duplicated.
Is there something I can do to fix this? Or adding translations requires me to delete everything and start over?
Apologies if this is a newbie question unrelated to the package or it's addressed somewhere in the documentation but it's my first time with Wagtail and my eyes are burning.
Cheers
The text was updated successfully, but these errors were encountered:
@zerolab many thanks. I believe the issue here was due to being fully guided by wagtail-localize.org. I can submit a PR with a warning in this section pointing to the docs if you believe that's the right approach
Hi, I'm running Wagtail 5.0 and wagtail-localize 1.6 and I'm getting an issue when adding translation to current models
I followed the tutorial up to the part where we translate content. I create a new migration where Wagtail suggests me to create a unique_together constraint. I do so but it still remains.
It then asks me for a default. I use the first locale ID
Then it breaks when I'm migrating
Is there something I can do to fix this? Or adding translations requires me to delete everything and start over?
Apologies if this is a newbie question unrelated to the package or it's addressed somewhere in the documentation but it's my first time with Wagtail and my eyes are burning.
Cheers
The text was updated successfully, but these errors were encountered: