mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Mark strings in AuthTokenSerializer as translatable
This commit is contained in:
parent
5333a93126
commit
c15dab903d
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user