diff options
| author | Tom Christie | 2014-12-15 12:18:55 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-15 12:18:55 +0000 |
| commit | b6ee784240b3c7f6cd62af5b6fe6d1014d7bf6d4 (patch) | |
| tree | e3cdb5a6e210e5ba26d6726cc08a44c8f450776b /rest_framework/validators.py | |
| parent | 8934e61b67e4aed38b04f2fe18f011ecbf9010cb (diff) | |
| parent | af53e34dd5873f3373e9991c3825e70d92432e14 (diff) | |
| download | django-rest-framework-b6ee784240b3c7f6cd62af5b6fe6d1014d7bf6d4.tar.bz2 | |
Merge master
Diffstat (limited to 'rest_framework/validators.py')
| -rw-r--r-- | rest_framework/validators.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/rest_framework/validators.py b/rest_framework/validators.py index 63eb7b22..e3719b8d 100644 --- a/rest_framework/validators.py +++ b/rest_framework/validators.py @@ -6,7 +6,9 @@ This gives us better separation of concerns, allows us to use single-step object creation, and makes it possible to switch between using the implicit `ModelSerializer` class and an equivalent explicit `Serializer` class. """ +from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ +from rest_framework.compat import unicode_to_repr from rest_framework.exceptions import ValidationError from rest_framework.utils.representation import smart_repr @@ -59,10 +61,10 @@ class UniqueValidator: raise ValidationError(self.message) def __repr__(self): - return '<%s(queryset=%s)>' % ( + return unicode_to_repr('<%s(queryset=%s)>' % ( self.__class__.__name__, smart_repr(self.queryset) - ) + )) class UniqueTogetherValidator: @@ -141,11 +143,11 @@ class UniqueTogetherValidator: raise ValidationError(self.message.format(field_names=field_names)) def __repr__(self): - return '<%s(queryset=%s, fields=%s)>' % ( + return unicode_to_repr('<%s(queryset=%s, fields=%s)>' % ( self.__class__.__name__, smart_repr(self.queryset), smart_repr(self.fields) - ) + )) class BaseUniqueForValidator: @@ -205,12 +207,12 @@ class BaseUniqueForValidator: raise ValidationError({self.field: message}) def __repr__(self): - return '<%s(queryset=%s, field=%s, date_field=%s)>' % ( + return unicode_to_repr('<%s(queryset=%s, field=%s, date_field=%s)>' % ( self.__class__.__name__, smart_repr(self.queryset), smart_repr(self.field), smart_repr(self.date_field) - ) + )) class UniqueForDateValidator(BaseUniqueForValidator): |
