I'm required to use the word "Role" instead of "Group" in a Django project.
I tried i18n, but could make auth
pick up the translation.
I also tried replacing django.contrib.auth
with a myaqpp.auth
where Group
is called ``Role.
Which is the correct way to do this renaming?
Is it just a question of displaying Role
in the admin interface, instead of Group
? In that case, you could easily create a proxy model:
model:
from django.contrib.auth.models import Group
from django.utils.translation import ugettext_lazy as _
class Role(Group):
class Meta:
proxy = True
app_label = 'auth'
verbose_name = _('Role')
and then unregister the default Group
model from the GroupAdmin
and register your Role
model instead:
from django.contrib.auth.admin import GroupAdmin
from django.contrib.auth.models import Group
from .models import Role
admin.site.unregister(Group)
admin.site.register(Role, GroupAdmin)
With all that said, I'd question the business decision forcing you to implement such a silly thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With