Skip to content

Machine Translating any Push Notification (News) leads to Internal Server Error #4216

@juliankehne

Description

@juliankehne

Describe the Bug

Found in cms-test on version Version: 2026.3.18-alpha

When attempting to machine translate any push notification (Existing or new one) when clicking 'Save' it leads to an Internal Server Error.

When creating a new push notification is does create it, but no translations are created

Steps to Reproduce

Reproducibility: Always

  1. Go to 'News'
  2. Click 'Create News'
  3. Enter title and content
  4. Select any of the two types
  5. Select 'Automatic Translation'
  6. Select any language
  7. Click 'Save'

Expected Behavior

Machine Translation works when saving / updating a push notification. No Error.

Actual Behavior

Internal Server Error when attempting to save / update a push notification and automatic translation is selected.

Screenshot

Additional Information

Traceback
Mar 25 11:44:52 ERROR django.request - 500 Internal Server Error: /testumgebung/push-notifications/de/new/
Traceback (most recent call last):
  File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/utils/decorators.py", line 46, in _wrapper
    return bound_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/integreat_cms/cms/views/push_notifications/push_notification_form_view.py", line 226, in post
    pn_translation_form.save()
  File "/home/micucu/integreat-cms/integreat_cms/cms/forms/push_notifications/push_notification_translation_form.py", line 210, in save
    api_client.translate_object(
  File "/home/micucu/integreat-cms/integreat_cms/core/utils/machine_translation_api_client.py", line 133, in translate_object
    return self.translate_queryset([obj], language_slug)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/integreat_cms/core/utils/machine_translation_api_client.py", line 176, in translate_queryset
    context = self.prepare_content_objects()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/micucu/integreat-cms/integreat_cms/core/utils/machine_translation_api_client.py", line 341, in prepare_content_objects
    content_object.get_translatable_attributes(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PushNotification' object has no attribute 'get_translatable_attributes'

Related Issues

Summary of discussion and updates to the description

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions