After upgrading to 5.0, I am getting this error in translated models.
I am using
django-model-utils==5.0.0
django-modeltranslation==0.19.9
My model
class ParameterModel(UUIDModel, SoftDeletableModelMixin):
value = models.CharField(verbose_name=_("value"), max_length=255)
sort_order = models.IntegerField(default=0)
class Meta:
verbose_name = _("parameter")
abstract = True
class Currency(ParameterModel):
default = models.BooleanField(default=False)
Translation registration:
class ParameterTranslationOptions(TranslationOptions):
fields = ("value",)
translator.register(Currency, ParameterTranslationOptions)
Error dump:
backend-1 | TypeError: class assignment: 'NewMultilingualManager' object layout differs from 'SoftDeletableManager'
backend-1 | /usr/local/lib/python3.12/site-packages/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
backend-1 | warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
backend-1 | Traceback (most recent call last):
backend-1 | File "/backend/manage.py", line 22, in
backend-1 | main()
backend-1 | File "/backend/manage.py", line 18, in main
backend-1 | execute_from_command_line(sys.argv)
backend-1 | File "/usr/local/lib/python3.12/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
backend-1 | utility.execute()
backend-1 | File "/usr/local/lib/python3.12/site-packages/django/core/management/init.py", line 416, in execute
backend-1 | django.setup()
backend-1 | File "/usr/local/lib/python3.12/site-packages/django/init.py", line 24, in setup
backend-1 | apps.populate(settings.INSTALLED_APPS)
backend-1 | File "/usr/local/lib/python3.12/site-packages/django/apps/registry.py", line 124, in populate
backend-1 | app_config.ready()
backend-1 | File "/usr/local/lib/python3.12/site-packages/modeltranslation/apps.py", line 11, in ready
backend-1 | handle_translation_registrations()
backend-1 | File "/usr/local/lib/python3.12/site-packages/modeltranslation/models.py", line 82, in handle_translation_registrations
backend-1 | autodiscover()
backend-1 | File "/usr/local/lib/python3.12/site-packages/modeltranslation/models.py", line 28, in autodiscover
backend-1 | import_module(module)
backend-1 | File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module
backend-1 | return _bootstrap._gcd_import(name[level:], package, level)
backend-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-1 | File "", line 1381, in _gcd_import
backend-1 | File "", line 1354, in _find_and_load
backend-1 | File "", line 1325, in _find_and_load_unlocked
backend-1 | File "", line 929, in _load_unlocked
backend-1 | File "", line 994, in exec_module
backend-1 | File "", line 488, in _call_with_frames_removed
backend-1 | File "/backend/common/translation.py", line 24, in
backend-1 | translator.register(Currency, ParameterTranslationOptions)
backend-1 | File "/usr/local/lib/python3.12/site-packages/modeltranslation/translator.py", line 529, in register
backend-1 | self._register_single_model(model, opts)
backend-1 | File "/usr/local/lib/python3.12/site-packages/modeltranslation/translator.py", line 559, in _register_single_model
backend-1 | add_manager(model)
backend-1 | File "/usr/local/lib/python3.12/site-packages/modeltranslation/translator.py", line 281, in add_manager
backend-1 | patch_manager_class(current_manager)
backend-1 | File "/usr/local/lib/python3.12/site-packages/modeltranslation/translator.py", line 263, in patch_manager_class
backend-1 | manager.class = NewMultilingualManager
backend-1 | ^^^^^^^^^^^^^^^^^
backend-1 | TypeError: class assignment: 'NewMultilingualManager' object layout differs from 'SoftDeletableManager'
After upgrading to 5.0, I am getting this error in translated models. I am using django-model-utils==5.0.0 django-modeltranslation==0.19.9
My model
Translation registration:
Error dump: