Open enzedonline opened 2 years ago
@enzedonline can you double check, is EmailSignature a site setting (which we don't yet support), or a snippet?
@zerolab it's a snippet:
It's only referenced in the ContactPage class, there are 3 other classes under HomePage that can't be translated also.
Would be good to get this resolved, still no further on understanding the cause of this and why I would get a Permission Denied error when logged in as super user - I'm thinking that's a red herring.
Stack from trying to translate a ServicePage model instance:
Traceback (most recent call last):
File "c:\Django\enzedonline\.venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "c:\Django\enzedonline\.venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "c:\Django\enzedonline\.venv\lib\site-packages\django\views\decorators\cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "c:\Django\enzedonline\.venv\lib\site-packages\wagtail\admin\urls\__init__.py", line 161, in wrapper
return view_func(request, *args, **kwargs)
File "c:\Django\enzedonline\.venv\lib\site-packages\wagtail\admin\auth.py", line 182, in decorated_view
response = view_func(request, *args, **kwargs)
File "c:\Django\enzedonline\.venv\lib\site-packages\django\views\generic\base.py", line 69, in view
return self.dispatch(request, *args, **kwargs)
File "c:\Django\enzedonline\.venv\lib\site-packages\wagtail_localize\views\submit_translations.py", line 175, in dispatch
return super().dispatch(request, *args, **kwargs)
File "c:\Django\enzedonline\.venv\lib\site-packages\django\views\generic\base.py", line 101, in dispatch
return handler(request, *args, **kwargs)
File "c:\Django\enzedonline\.venv\lib\site-packages\wagtail_localize\views\submit_translations.py", line 119, in post
return self.form_valid(form)
File "C:\Program Files\Python310\lib\contextlib.py", line 79, in inner
return func(*args, **kwds)
File "c:\Django\enzedonline\.venv\lib\site-packages\wagtail_localize\views\submit_translations.py", line 151, in form_valid
single_translated_object = self.object.get_translation(
File "c:\Django\enzedonline\.venv\lib\site-packages\wagtail\models\i18n.py", line 165, in get_translation
return self.get_translations(inclusive=True).get(locale_id=pk(locale))
File "c:\Django\enzedonline\.venv\lib\site-packages\django\db\models\query.py", line 439, in get
raise self.model.DoesNotExist(
Exception Type: DoesNotExist at /admin/localize/submit/page/41/
Exception Value: ServicePage matching query does not exist.
Similar issue translating snippets:
DoesNotExist at /admin/localize/submit/snippet/blog/personalblogcategory/9/
PersonalBlogCategory matching query does not exist.
Environment:
Request Method: POST
Request URL: http://localhost:8000/admin/localize/submit/snippet/blog/personalblogcategory/9/
Django Version: 4.0.2
Python Version: 3.10.6
Installed Applications:
['home',
'search',
'service',
'blog',
'menu',
'core',
'site_settings',
'contact',
'userauth',
'adv_cache_tag',
'rest_framework',
'wagtailmetadata',
'wagtailfontawesome',
'widget_tweaks',
'django_comments_xtd',
'django_comments',
'django_extensions',
'wagtail_localize',
'wagtail_localize.locales',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.contrib.routable_page',
'wagtail.contrib.modeladmin',
'wagtail.contrib.settings',
'wagtail.contrib.sitemaps',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail',
'modelcluster',
'taggit',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.linkedin_oauth2',
'captcha',
'wagtailcaptcha']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.middleware.locale.LocaleMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware']
Traceback (most recent call last):
File "\.venv\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "\.venv\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "\.venv\lib\site-packages\django\views\decorators\cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "\.venv\lib\site-packages\wagtail\admin\urls\__init__.py", line 161, in wrapper
return view_func(request, *args, **kwargs)
File "\.venv\lib\site-packages\wagtail\admin\auth.py", line 182, in decorated_view
response = view_func(request, *args, **kwargs)
File "\.venv\lib\site-packages\django\views\generic\base.py", line 69, in view
return self.dispatch(request, *args, **kwargs)
File "\.venv\lib\site-packages\wagtail_localize\views\submit_translations.py", line 175, in dispatch
return super().dispatch(request, *args, **kwargs)
File "\.venv\lib\site-packages\django\views\generic\base.py", line 101, in dispatch
return handler(request, *args, **kwargs)
File "\.venv\lib\site-packages\wagtail_localize\views\submit_translations.py", line 119, in post
return self.form_valid(form)
File "\Python310\lib\contextlib.py", line 79, in inner
return func(*args, **kwds)
File "\.venv\lib\site-packages\wagtail_localize\views\submit_translations.py", line 151, in form_valid
single_translated_object = self.object.get_translation(
File "\.venv\lib\site-packages\wagtail\models\i18n.py", line 165, in get_translation
return self.get_translations(inclusive=True).get(locale_id=pk(locale))
File "\.venv\lib\site-packages\django\db\models\query.py", line 439, in get
raise self.model.DoesNotExist(
Exception Type: DoesNotExist at /admin/localize/submit/snippet/blog/personalblogcategory/9/
Exception Value: PersonalBlogCategory matching query does not exist.
I’m having the same error with snippets is the already a fix to handle the error [Object].DoesntExist even if the object exists?
Thanks in advance.
[object ] will be the page model
This is happening on my dev site, I don't have a second locale on the live site enabled yet. When I came across this earlier, I checked existing translations were ok and could be sync'd - everything fine there. I decided to delete all the objects in the translated locale, delete the locale in the admin interface and start over. Now I can only translate as far down as the home page, anything below throws this error.
When I look at the last calls before the exception, the variables look ok:
Page 41 is the correct ID for the page I'm trying to translate in this case.
One model has a snippet. That throws a similar error but that it can't find the snippet instance which I guess is related but hits before submitting the page as above.
I've tried this with both translated and untranslated snippet, same result.
Stepping through to see if I could pick up anything, it seems the error is thrown in
wagtail.admin.auth.require_admin_access
This last line throws a
PermissionDenied
error, which doesn't make sense as I'm logged in with superuser account. I checked all the permissions for the account in django-admin, it's all there.Any idea what can cause this?
Django Version: 4.0.2 Python Version: 3.9.4 Wagtail: 3.0.1 wagtail-localize: 1.2.1