aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authtoken/serializers.py
diff options
context:
space:
mode:
authorCharlie Denton2014-05-01 10:18:16 +0100
committerCharlie Denton2014-05-01 10:18:16 +0100
commitc15dab903d3759578449279cc034d766d362d41f (patch)
tree1beb56c8f31c7b6d82bf8f63b06b9c81eddd54ce /rest_framework/authtoken/serializers.py
parent5333a9312613cffa573b4b38acfaa8d402286174 (diff)
downloaddjango-rest-framework-c15dab903d3759578449279cc034d766d362d41f.tar.bz2
Mark strings in AuthTokenSerializer as translatable
Diffstat (limited to 'rest_framework/authtoken/serializers.py')
-rw-r--r--rest_framework/authtoken/serializers.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/rest_framework/authtoken/serializers.py b/rest_framework/authtoken/serializers.py
index 60a3740e..995f2e64 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()
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)