Reputation: 21
I want to translate my from django.contrib.auth.models import User Model's first_name and last_name. I am aware of Custom User Model in Django. But is there any better way of translating using django Hvad
For reference i am attaching my Model here
class UserProfile(TranslatableModel):
translations = CustomTranslatedFields(
bio=models.TextField(
verbose_name=_('Biography'),
blank=True
),
)
user = models.OneToOneField(
User,
related_name='user_profile',
verbose_name=_('User Profile'),
)
default_language = models.CharField(
max_length=2,
choices=LANGUAGES,
default='en'
)
As you can see bio field is translatable but how would i be able to translate my User models first_name and last_name field
Upvotes: 2
Views: 271
Reputation: 2263
Because of the way Django Hvad defines translatable fields, there is actually no way to do it unless you define your own User model.
Upvotes: 0