diff --git a/polymorphic/managers.py b/polymorphic/managers.py index 41fdbd9..875d40b 100644 --- a/polymorphic/managers.py +++ b/polymorphic/managers.py @@ -8,7 +8,13 @@ import django from django.db import models 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): """ Manager for PolymorphicModel @@ -44,7 +50,7 @@ class PolymorphicManager(models.Manager): if django.VERSION < (1, 7): get_query_set = get_queryset - def __unicode__(self): + def __str__(self): return '%s (PolymorphicManager) using %s' % (self.__class__.__name__, self.queryset_class.__name__) # Proxied methods diff --git a/polymorphic/showfields.py b/polymorphic/showfields.py index a7270d5..360b847 100644 --- a/polymorphic/showfields.py +++ b/polymorphic/showfields.py @@ -28,7 +28,7 @@ class ShowFieldBase(object): polymorphic_showfield_old_format = False def __repr__(self): - return self.__unicode__() + return self.__str__() def _showfields_get_content(self, field_name, field_type=type(None)): "helper for __unicode__"