diff options
| author | Charlie Denton | 2014-05-01 10:18:16 +0100 |
|---|---|---|
| committer | Charlie Denton | 2014-05-01 10:18:16 +0100 |
| commit | c15dab903d3759578449279cc034d766d362d41f (patch) | |
| tree | 1beb56c8f31c7b6d82bf8f63b06b9c81eddd54ce | |
| parent | 5333a9312613cffa573b4b38acfaa8d402286174 (diff) | |
| download | django-rest-framework-c15dab903d3759578449279cc034d766d362d41f.tar.bz2 | |
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..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) |
