{"action":"created","issue":{"url":"https://api.github.com/repos/deschler/django-modeltranslation/issues/389","repository_url":"https://api.github.com/repos/deschler/django-modeltranslation","labels_url":"https://api.github.com/repos/deschler/django-modeltranslation/issues/389/labels{/name}","comments_url":"https://api.github.com/repos/deschler/django-modeltranslation/issues/389/comments","events_url":"https://api.github.com/repos/deschler/django-modeltranslation/issues/389/events","html_url":"https://github.com/deschler/django-modeltranslation/issues/389","id":184001255,"number":389,"title":"Django 1.10 default manager not MultilingualManager for model inheriting abstract class with a manager defined on objects (leading to AttributeError: 'QuerySet' object has no attribute 'rewrite')","user":{"login":"nealtodd","id":298652,"avatar_url":"https://avatars.githubusercontent.com/u/298652?v=3","gravatar_id":"","url":"https://api.github.com/users/nealtodd","html_url":"https://github.com/nealtodd","followers_url":"https://api.github.com/users/nealtodd/followers","following_url":"https://api.github.com/users/nealtodd/following{/other_user}","gists_url":"https://api.github.com/users/nealtodd/gists{/gist_id}","starred_url":"https://api.github.com/users/nealtodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nealtodd/subscriptions","organizations_url":"https://api.github.com/users/nealtodd/orgs","repos_url":"https://api.github.com/users/nealtodd/repos","events_url":"https://api.github.com/users/nealtodd/events{/privacy}","received_events_url":"https://api.github.com/users/nealtodd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-10-19T15:49:21Z","updated_at":"2017-01-06T22:23:42Z","closed_at":null,"body":"Whilst upgrading my application to Django 1.10 I came across the following issue where the default manager for a Model Translation registered model didn't get dynamically set to `modeltranslation.manager.MultilingualManager`.\n\nThis resulted in an exception being thrown in [update_translation_fields.py L32](https://github.com/deschler/django-modeltranslation/blob/master/modeltranslation/management/commands/update_translation_fields.py#L32)\n\n`AttributeError: 'QuerySet' object has no attribute 'rewrite'`\n\nA similar issue was resolved in #123 but it seems something in the internal changes in Django 1.10 has resurfaced it in the particular scenario I have (not one covered by #381).\n\nI haven't yet identified what the changes are that cause it but I've narrowed the scenario down to one in which a model inherits from an abstract model that explicitly sets a manager via the  `objects` attribute. In this case the resulting `_default_manager` is that set on `objects` rather than `modeltranslation.manager.MultilingualManager`.\n\nThe simplest example I can boil it down to is this:\n\n```\n# models.py\n\nclass FooAbstract(models.Model):\n    class Meta:\n        abstract = True\n\nclass Foo(FooAbstract):\n    name = models.CharField(blank=True, max_length=1)\n\nclass Bar(models.Model):\n    objects = models.Manager()\n    name = models.CharField(blank=True, max_length=1)\n\nclass BazAbstract(models.Model):\n    objects = models.Manager()\n    class Meta:\n        abstract = True\n\nclass Baz(BazAbstract):\n    name = models.CharField(blank=True, max_length=1)\n\n\n# translations.py\n\n@register(Foo)\nclass FooTranslationOptions(TranslationOptions):\n    fields = ('name',)\n\n@register(Bar)\nclass BarTranslationOptions(TranslationOptions):\n    fields = ('name',)\n\n@register(Baz)\nclass BazTranslationOptions(TranslationOptions):\n    fields = ('name',)\n\n\n# shell\n\nfrom modeltranslation.translator import translator\nmodels = translator.get_registered_models(abstract=False)\nfor model in models:\n    print(model.__name__, type(model._default_manager))\n\n# Django 1.9 output:\n\nFoo <class 'modeltranslation.manager.MultilingualManager'>\nBar <class 'modeltranslation.manager.MultilingualManager'>\nBaz <class 'modeltranslation.manager.MultilingualManager'>\n\n# Django 1.10 output:\n\nFoo <class 'modeltranslation.manager.MultilingualManager'>\nBar <class 'modeltranslation.manager.MultilingualManager'>\nBaz <class 'django.db.models.manager.Manager'>\n```\n\nI don't have a solution yet but thought I'd submit it as an issue now in case anyone has any ideas?\n"},"comment":{"url":"https://api.github.com/repos/deschler/django-modeltranslation/issues/comments/271026997","html_url":"https://github.com/deschler/django-modeltranslation/issues/389#issuecomment-271026997","issue_url":"https://api.github.com/repos/deschler/django-modeltranslation/issues/389","id":271026997,"user":{"login":"logileifs","id":2317815,"avatar_url":"https://avatars.githubusercontent.com/u/2317815?v=3","gravatar_id":"","url":"https://api.github.com/users/logileifs","html_url":"https://github.com/logileifs","followers_url":"https://api.github.com/users/logileifs/followers","following_url":"https://api.github.com/users/logileifs/following{/other_user}","gists_url":"https://api.github.com/users/logileifs/gists{/gist_id}","starred_url":"https://api.github.com/users/logileifs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/logileifs/subscriptions","organizations_url":"https://api.github.com/users/logileifs/orgs","repos_url":"https://api.github.com/users/logileifs/repos","events_url":"https://api.github.com/users/logileifs/events{/privacy}","received_events_url":"https://api.github.com/users/logileifs/received_events","type":"User","site_admin":false},"created_at":"2017-01-06T22:23:42Z","updated_at":"2017-01-06T22:23:42Z","body":"is there any update on this? @zlorf have you started working on this issue yet?"}}
{"actor":{"display_login":"logileifs"}}