wagtail-localize
wagtail-localize copied to clipboard
'ManyToOneRel' object has no attribute 'help_text' when translating FormPage
The issue, don't know what else to say 😄:
Traceback (most recent call last):
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\django\core\handlers\base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\django\views\decorators\cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\wagtail\admin\urls\__init__.py", line 127, in wrapper
return view_func(request, *args, **kwargs)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\wagtail\admin\auth.py", line 172, in decorated_view
response = view_func(request, *args, **kwargs)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\django\views\generic\base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\wagtail\admin\views\pages\edit.py", line 114, in dispatch
response = self.run_hook('before_edit_page', self.request, self.page)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\wagtail\admin\views\generic.py", line 60, in run_hook
result = fn(*args, **kwargs)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\wagtail_localize\wagtail_hooks.py", line 144, in before_edit_page
return edit_translation.edit_translation(request, translation, page)
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\wagtail_localize\views\edit_translation.py", line 471, in edit_translation
string_segment_data = [
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\wagtail_localize\views\edit_translation.py", line 477, in <listcomp>
'location': get_segment_location_info(source_instance, tab_helper, segment.context.path),
File "C:\Users\Shaffle\.virtualenvs\Qp0hboiu\lib\site-packages\wagtail_localize\views\edit_translation.py", line 329, in get_segment_location_info
'fieldHelpText': child_field.help_text,
Exception Type: AttributeError at /admin/pages/57/edit/
Exception Value: 'ManyToOneRel' object has no attribute 'help_text'
Update:
I tried to replace this 'fieldHelpText': child_field.help_text,
in wagtail_localize/views/edit_translation.py
on line 329 with this child_field.help_text if hasattr(child_field, 'help_text') else None
.
And then another error appeared:
File "C:\Users\Shaffle\.virtualenvs\mistralvision-Qp0hboiu\lib\site-packages\wagtail_localize\views\edit_translation.py", line 330, in get_segment_location_info
'subField': capfirst(child_field.verbose_name),
Did the same with this one
'subField': capfirst(child_field.verbose_name) if hasattr(child_field, 'verbose_name') else None,
and it works.
I don't know if this is the right way to do it, so I won't make a PR 😞.
Got the same issue. I used your workaround but I do think a fix would be beneficial
Hey all, happy to review a pull request with the fix noted above