Open jams2 opened 2 years ago
Not sure if this is the correct way to fix, or if it is destructive, but this seemed to work for me:
from wagtail_localize.models import TranslationSource
for ts in TranslationSource.objects.all().iterator():
ts.update_from_db()
This also applies when a field is renamed.
The least invasive fix would be a try/except around
wagtail_localize/views/edit_translation.py", line 318, in get_segment_location_info
field = source_instance._meta.get_field(field_path_components[0])
Happy to review a PR
Traceback
Steps to reproduce
wagtail-localize
and a simple page model will do)NewModel
, saving changes as draft only (or publish first, make changes, and save as draft)NewModel
, renaming one of the fields (e.g.description
->foo_description
)makemigrations
(entery
to indicate you renamed the field) andmigrate
The error does not occur when the source page has no unpublished revisions, the warning message (
The data model for 'New model' has been changed since the last translation sync. If any new fields have been added recently, these may not be visible until the next translation sync.
) is displayed.Syncing the translations (page explorer -> source page -> more -> Sync translated pages) stops the error from occurring, but ideally the error would be handled gracefully.