Make 'duplicate_username' message translatable
Added ugettext_lazy and used it on the 'duplicate_username' message
@@ -3,7 +3,7 @@ from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User
-
+from django.utils.translation import ugettext_lazy as _
class MyUserChangeForm(UserChangeForm):
@@ -14,7 +14,7 @@ class MyUserChangeForm(UserChangeForm):
class MyUserCreationForm(UserCreationForm):
error_message = UserCreationForm.error_messages.update(
- {"duplicate_username": "This username has already been taken."}
+ {"duplicate_username": _("This username has already been taken.")}
)
class Meta(UserCreationForm.Meta):
