deschler / django-modeltranslation

Translates Django models using a registration approach.
BSD 3-Clause "New" or "Revised" License
1.38k stars 257 forks source link

Django 1.9 error (also Django 1.8 is affected) #350

Closed gabn88 closed 8 years ago

gabn88 commented 8 years ago

Traceback (most recent call last): File "./manage.py", line 10, in execute_from_command_line(sys.argv) File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/core/management/init.py", line 350, in execute_from_command_line utility.execute() File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/core/management/init.py", line 342, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/core/management/base.py", line 348, in run_from_argv self.execute(_args, _cmd_options) File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/core/management/base.py", line 399, in execute output = self.handle(_args, _options) File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/core/management/commands/makemigrations.py", line 106, in handle ProjectState.from_apps(apps), File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/db/migrations/state.py", line 174, in from_apps model_state = ModelState.from_model(model) File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/db/migrations/state.py", line 484, in from_model reconstruct_manager(model._default_manager) File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/db/migrations/state.py", line 468, in reconstruct_manager as_manager, manager_path, qs_path, args, kwargs = mgr.deconstruct() File "/home//.virtualenvs/skillshare/lib/python3.4/site-packages/django/db/models/manager.py", line 105, in deconstruct % (name, module_name) ValueError: Could not find manager NewMultilingualManager in modeltranslation.translator. Please note that you need to inherit from managers you dynamically generated with 'from_queryset()'.

I get this error when using django 1.9 and django-modeltranslation 0.11rc1...

For your information, I did ./manage.py makemigrations

gabn88 commented 8 years ago

I complete deleted and rebuild my virtualenv but the error still persists. I would say this is blocking for releasing .11rc1 :(

zlorf commented 8 years ago

I agree.

gabn88 commented 8 years ago

The issue could have to do with have the Permission Model of django.contrib.auth as a translatable field:

class PermissionTranslationOptions(TranslationOptions): fields = ('name', )

translator.register(Permission, PermissionTranslationOptions)

gabn88 commented 8 years ago

I was wondering, do I need to update the db manually to 255 characters, or does modeltranslation handle this as well? (because django updated the permission name to 255 instead of 50) (I know how to do this and it is easy, but just asking)

zlorf commented 8 years ago

The problem is with a custom Manager on a translatable model (don't know which).

gabn88 commented 8 years ago

I reverted back to Django 1.7.9 and everything is fine now. I have many Custom Managers, so I don't know where to start searching...

zlorf commented 8 years ago

Can you try the master version of MT? If it's working, we'll make another RC release.

gabn88 commented 8 years ago

Thank you for your effort, but it is giving me the same error:

Traceback (most recent call last):
  File "test_production/manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "/home/test_production_v3/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/test_production_v3/lib/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/test_production_v3/lib/python3.4/site-packages/django/core/management/base.py", line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/test_production_v3/lib/python3.4/site-packages/django/core/management/base.py", line 444, in execute
    output = self.handle(*args, **options)
  File "/home/test_production_v3/lib/python3.4/site-packages/django/core/management/commands/makemigrations.py", line 99, in handle
    ProjectState.from_apps(apps),
  File "/home/test_production_v3/lib/python3.4/site-packages/django/db/migrations/state.py", line 178, in from_apps
    model_state = ModelState.from_model(model)
  File "/home/test_production_v3/lib/python3.4/site-packages/django/db/migrations/state.py", line 441, in from_model
    reconstruct_manager(model._default_manager)
  File "/home/test_production_v3/lib/python3.4/site-packages/django/db/migrations/state.py", line 425, in reconstruct_manager
    as_manager, manager_path, qs_path, args, kwargs = mgr.deconstruct()
  File "/home/test_production_v3/lib/python3.4/site-packages/django/db/models/manager.py", line 110, in deconstruct
    % (name, module_name)
ValueError: Could not find manager NewMultilingualManager in modeltranslation.translator.
Please note that you need to inherit from managers you dynamically generated with 'from_queryset()'.

Using https://github.com/deschler/django-modeltranslation/archive/master.zip of today.

By the way, django version is 1.8.3.

gabn88 commented 8 years ago

Ah, wait! I updated my models to MyModel(MultiLinguageManager, models.Model).. Now set them back to MyModel(models.Model) and it is working fine! :+1:

zlorf commented 8 years ago

Glad to hear. @desher, would you please make another RC then?

deschler commented 8 years ago

I've released another rc. Thank you!