diff options
| author | Tom Christie | 2014-12-18 11:21:25 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-18 11:21:25 +0000 |
| commit | c8d88c8c8a594e3b66547a34462db4766292ea9e (patch) | |
| tree | 09d1e53c9c019501b85ff8892dca4177c95a6e0b /rest_framework/relations.py | |
| parent | 47fe6977077ae33dfe2f8b6d04d81083b9b9f4d7 (diff) | |
| parent | d8803a35bd2dc8cbf4c892f68b48c72f24e83916 (diff) | |
| download | django-rest-framework-c8d88c8c8a594e3b66547a34462db4766292ea9e.tar.bz2 | |
Merge branch 'master' into version-3.1
Diffstat (limited to 'rest_framework/relations.py')
| -rw-r--r-- | rest_framework/relations.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 892ce6c1..7b119291 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -1,13 +1,15 @@ -from django.utils.encoding import smart_text -from rest_framework.fields import get_attribute, empty, Field -from rest_framework.reverse import reverse -from rest_framework.utils import html +# coding: utf-8 +from __future__ import unicode_literals from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured from django.core.urlresolvers import resolve, get_script_prefix, NoReverseMatch, Resolver404 from django.db.models.query import QuerySet from django.utils import six +from django.utils.encoding import smart_text from django.utils.six.moves.urllib import parse as urlparse from django.utils.translation import ugettext_lazy as _ +from rest_framework.fields import get_attribute, empty, Field +from rest_framework.reverse import reverse +from rest_framework.utils import html class PKOnlyObject(object): @@ -103,8 +105,8 @@ class RelatedField(Field): def choices(self): return dict([ ( - str(self.to_representation(item)), - str(item) + six.text_type(self.to_representation(item)), + six.text_type(item) ) for item in self.queryset.all() ]) @@ -364,8 +366,8 @@ class ManyRelatedField(Field): ] return dict([ ( - str(item_representation), - str(item) + ' - ' + str(item_representation) + six.text_type(item_representation), + six.text_type(item) + ' - ' + six.text_type(item_representation) ) for item, item_representation in items_and_representations ]) |
