diff options
| author | Carlton Gibson | 2014-05-06 10:53:06 +0200 |
|---|---|---|
| committer | Carlton Gibson | 2014-05-06 10:53:06 +0200 |
| commit | 0097fbc8617f39ea3f8019a4e8a180559b75fdac (patch) | |
| tree | 4e30c8b76be1328c2e1e9d5bef09ca0c2e0c2ab8 | |
| parent | 28691f2cb1266b9675285f488ab23894ccac0d2d (diff) | |
| parent | ccf3c508bd6750073ea3bbaefff567b92880df73 (diff) | |
| download | django-rest-framework-0097fbc8617f39ea3f8019a4e8a180559b75fdac.tar.bz2 | |
Merge pull request #1561 from incuna/i18n
Mark strings in AuthTokenSerializer as translatable
| -rw-r--r-- | rest_framework/authtoken/serializers.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/rest_framework/authtoken/serializers.py b/rest_framework/authtoken/serializers.py index 60a3740e..99e99ae3 100644 --- a/rest_framework/authtoken/serializers.py +++ b/rest_framework/authtoken/serializers.py @@ -1,4 +1,6 @@ from django.contrib.auth import authenticate +from django.utils.translation import ugettext_lazy as _ + from rest_framework import serializers @@ -15,10 +17,13 @@ class AuthTokenSerializer(serializers.Serializer): if user: if not user.is_active: - raise serializers.ValidationError('User account is disabled.') + msg = _('User account is disabled.') + raise serializers.ValidationError(msg) attrs['user'] = user return attrs else: - raise serializers.ValidationError('Unable to login with provided credentials.') + msg = _('Unable to login with provided credentials.') + raise serializers.ValidationError(msg) else: - raise serializers.ValidationError('Must include "username" and "password"') + msg = _('Must include "username" and "password"') + raise serializers.ValidationError(msg) |
