44from django .conf import settings
55from django .db import models
66from django .utils .encoding import python_2_unicode_compatible
7+ from django .utils .translation import ugettext_lazy as _
78
89# Prior to Django 1.5, the AUTH_USER_MODEL setting does not exist.
910# Note that we don't perform this code in the compat module due to
@@ -17,10 +18,10 @@ class Token(models.Model):
1718 """
1819 The default authorization token model.
1920 """
20- key = models .CharField (max_length = 40 , primary_key = True )
21+ key = models .CharField (_ ( "Key" ), max_length = 40 , primary_key = True )
2122 user = models .OneToOneField (AUTH_USER_MODEL , related_name = 'auth_token' ,
22- on_delete = models .CASCADE )
23- created = models .DateTimeField (auto_now_add = True )
23+ on_delete = models .CASCADE , verbose_name = _ ( "User" ) )
24+ created = models .DateTimeField (_ ( "Created" ), auto_now_add = True )
2425
2526 class Meta :
2627 # Work around for a bug in Django:
@@ -29,6 +30,8 @@ class Meta:
2930 # Also see corresponding ticket:
3031 # https://github.com/tomchristie/django-rest-framework/issues/705
3132 abstract = 'rest_framework.authtoken' not in settings .INSTALLED_APPS
33+ verbose_name = _ ("Token" )
34+ verbose_name_plural = _ ("Tokens" )
3235
3336 def save (self , * args , ** kwargs ):
3437 if not self .key :
0 commit comments