Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdce544e

Browse files
committed
Merge pull request#3887 from mnach/enhancement-3886
enhancement#3886 Internationalization in admin interface for authtoken
2 parentsd738ad7 +d0f7b04 commitdce544e

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
default_app_config='rest_framework.authtoken.apps.AuthTokenConfig'

‎rest_framework/authtoken/apps.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fromdjango.appsimportAppConfig
2+
fromdjango.utils.translationimportugettext_lazyas_
3+
4+
5+
classAuthTokenConfig(AppConfig):
6+
name='rest_framework.authtoken'
7+
verbose_name=_("Auth Token")

‎rest_framework/authtoken/models.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
fromdjango.confimportsettings
55
fromdjango.dbimportmodels
66
fromdjango.utils.encodingimportpython_2_unicode_compatible
7+
fromdjango.utils.translationimportugettext_lazyas_
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
classMeta:
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'notinsettings.INSTALLED_APPS
33+
verbose_name=_("Token")
34+
verbose_name_plural=_("Tokens")
3235

3336
defsave(self,*args,**kwargs):
3437
ifnotself.key:

‎rest_framework/authtoken/serializers.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66

77
classAuthTokenSerializer(serializers.Serializer):
8-
username=serializers.CharField()
9-
password=serializers.CharField(style={'input_type':'password'})
8+
username=serializers.CharField(label=_("Username"))
9+
password=serializers.CharField(label=_("Password"),style={'input_type':'password'})
1010

1111
defvalidate(self,attrs):
1212
username=attrs.get('username')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp