django-modeltranslation: Does not work with Django 1.10
Hello,
I was testing if I can use Django 1.10 in a project I’m working right now, but seems that the removal of ._defered attribute in Django 1.10 broke django-modeltranslation.
I tried to see if it was a quick fix but seems you rely a lot on deferred fields so I’m not the best person to fix it =(
Here is my traceback:
» python manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10a54c378>
Traceback (most recent call last):
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run
autoreload.raise_last_exception()
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/modeltranslation/apps.py", line 11, in ready
handle_translation_registrations()
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/modeltranslation/models.py", line 81, in handle_translation_registrations
autodiscover()
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/modeltranslation/models.py", line 32, in autodiscover
import_module(module)
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/Volumes/DADOS/Work/sandbox/enjbrasil/fuji/apps/commons/translation.py", line 6, in <module>
class CountryTranslationOptions(TranslationOptions):
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/modeltranslation/decorators.py", line 23, in wrapper
translator.register(model_or_iterable, opts_class, **options)
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/modeltranslation/translator.py", line 427, in register
opts = self._get_options_for_model(model, opts_class, **options)
File "/Volumes/DADOS/Work/ambientes/fuji/lib/python3.5/site-packages/modeltranslation/translator.py", line 547, in _get_options_for_model
if model._deferred:
AttributeError: type object 'Country' has no attribute '_deferred'
Any ideas?
Thanks for your project, it’s amazing =)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 8
- Comments: 36 (6 by maintainers)
Commits related to this issue
- Django 1.10 integration (ref #381) — committed to deschler/django-modeltranslation by zlorf 8 years ago
All test are passing on all Django versions. Probably I still need to add one more test and fix two recent issues, so by the end of the week a Django 1.10-compatible version will be released.
Made the release yesterday. Closing here. Thanks everyone!
Progress info: most of the issues were resolved. Only
autodiscovertest is failing, but it’s not surprising since lots of hacking happens there.Ok @deschler , docs updated. The code is ready for you to make release ritual! (after putting a lot of entries to changelog ;P )
Ok, master branch should be Django 1.10 compatible. Whoever want to contribute to testing, you can install it by invoking
pip install https://github.com/deschler/django-modeltranslation/archive/master.zip. Please report here any issues found, that are not covered by tests.Yep. That’s what I tried, but in the wrong folder. Got it now.
Nevertheless, the deprecated
option_listshould be fixed.@hymnis Thanks, this is important. I need to fix this before release.
I’ve installed modeltranslation master branch in my project and updated Django from 1.9.6 to 1.10.
I needed to fix some Django 1.10 specific stuff in my project (not modeltranslation related). After that modeltranslation registered 6 models for translation with 1-4 fields per model using 4 languages.
I ran all my tests. All green. Then I dropped and recreated the db. All good. Finally build many fixtures without problems.
@zlorf: Thanks for the good work. Modeltranslation works like a charm.