|
1 |
| -from django.utils.encoding import smart_text |
2 |
| -from rest_framework.fields import get_attribute, empty, Field |
3 |
| -from rest_framework.reverse import reverse |
4 |
| -from rest_framework.utils import html |
| 1 | +# coding: utf-8 |
| 2 | +from __future__ import unicode_literals |
5 | 3 | from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
|
6 | 4 | from django.core.urlresolvers import resolve, get_script_prefix, NoReverseMatch, Resolver404
|
7 | 5 | from django.db.models.query import QuerySet
|
8 | 6 | from django.utils import six
|
| 7 | +from django.utils.encoding import smart_text |
9 | 8 | from django.utils.six.moves.urllib import parse as urlparse
|
10 | 9 | from django.utils.translation import ugettext_lazy as _
|
| 10 | +from rest_framework.fields import get_attribute, empty, Field |
| 11 | +from rest_framework.reverse import reverse |
| 12 | +from rest_framework.utils import html |
11 | 13 |
|
12 | 14 |
|
13 | 15 | class PKOnlyObject(object):
|
@@ -103,8 +105,8 @@ def get_attribute(self, instance):
|
103 | 105 | def choices(self):
|
104 | 106 | return dict([
|
105 | 107 | (
|
106 |
| - str(self.to_representation(item)), |
107 |
| - str(item) |
| 108 | + six.text_type(self.to_representation(item)), |
| 109 | + six.text_type(item) |
108 | 110 | )
|
109 | 111 | for item in self.queryset.all()
|
110 | 112 | ])
|
@@ -364,8 +366,8 @@ def choices(self):
|
364 | 366 | ]
|
365 | 367 | return dict([
|
366 | 368 | (
|
367 |
| - str(item_representation), |
368 |
| - str(item) + ' - ' + str(item_representation) |
| 369 | + six.text_type(item_representation), |
| 370 | + six.text_type(item) + ' - ' + six.text_type(item_representation) |
369 | 371 | )
|
370 | 372 | for item, item_representation in items_and_representations
|
371 | 373 | ])
|
0 commit comments