django-modeltranslation
django-modeltranslation copied to clipboard
Translating Django auth models
I would like to know the best way to translate authorization models, like Group and Permission (standard way, meaning, not customized).
Modeltranslation works perfectly with my apps, but I don’t know how to do it for “third parties” (since this is a Django class - django.contrib.auth.models).
My environment is Python 3.4.3 and Django 1.8.4, and migration is running. django-modeltranlation==0.10.1
Thanks in advance.
It should be as easy as this:
from django.contrib.auth.models import Group
from modeltranslation.translator import translator, TranslationOptions
@register(Group)
class GroupTranslationOptions(TranslationOptions):
fields = ('name',) # or whatever these fields are called
It was performed as suggested, but I received the following error:
ValueError: Could not find manager NewMultilingualManager in modeltranslation.translator.
Please note that you need to inherit from managers you dynamically generated with 'from_queryset()'.
Process finished with exit code 1
I tried to follow the issue issue #330, but it didn't work either. Any ideas?
Same issue here. I put the modeltranslation on the Permission model of contrib.auth.models. Cannot update to Django 1.8 or higher due to this issue :(
yes, I tried Django 1.8.3 and Django 1.9, both gave this error. Django 1.7.9 is fine.
Current RC should fix this.
We have to migrate django.contrib.auth models in order to use that, hence run 'makemigrations' on test and production servers; is there no better way?