Fixed the Python 3 unittests

fix_request_path_info
Diederik van der Boor 2016-08-10 14:02:36 +02:00
parent cf1d4b532d
commit e20401d8bc
2 changed files with 8 additions and 2 deletions

View File

@ -8,7 +8,13 @@ import django
from django.db import models from django.db import models
from polymorphic.query import PolymorphicQuerySet from polymorphic.query import PolymorphicQuerySet
try:
from django.utils.six import python_2_unicode_compatible
except ImportError:
from django.utils.encoding import python_2_unicode_compatible # Django 1.5
@python_2_unicode_compatible
class PolymorphicManager(models.Manager): class PolymorphicManager(models.Manager):
""" """
Manager for PolymorphicModel Manager for PolymorphicModel
@ -44,7 +50,7 @@ class PolymorphicManager(models.Manager):
if django.VERSION < (1, 7): if django.VERSION < (1, 7):
get_query_set = get_queryset get_query_set = get_queryset
def __unicode__(self): def __str__(self):
return '%s (PolymorphicManager) using %s' % (self.__class__.__name__, self.queryset_class.__name__) return '%s (PolymorphicManager) using %s' % (self.__class__.__name__, self.queryset_class.__name__)
# Proxied methods # Proxied methods

View File

@ -28,7 +28,7 @@ class ShowFieldBase(object):
polymorphic_showfield_old_format = False polymorphic_showfield_old_format = False
def __repr__(self): def __repr__(self):
return self.__unicode__() return self.__str__()
def _showfields_get_content(self, field_name, field_type=type(None)): def _showfields_get_content(self, field_name, field_type=type(None)):
"helper for __unicode__" "helper for __unicode__"