3232Classes
3333-------
3434'''
35+ from __future__ import unicode_literals
3536from builtins import object
3637
3738
4445from django .contrib .sites .models import Site
4546from django .contrib .sites .managers import CurrentSiteManager
4647from django .conf import settings
48+ from django .utils .encoding import python_2_unicode_compatible
4749
4850from .validators import *
4951from .fields import EavSlugField , EavDatatypeField
@@ -81,9 +83,10 @@ class EnumValue(models.Model):
8183 value = models .CharField (_ (u"value" ), db_index = True ,
8284 unique = True , max_length = 50 )
8385
84- def __unicode__ (self ):
86+ @python_2_unicode_compatible
87+ def __str__ (self ):
8588 return self .value
86-
89+
8790
8891class EnumGroup (models .Model ):
8992 '''
@@ -98,7 +101,8 @@ class EnumGroup(models.Model):
98101
99102 enums = models .ManyToManyField (EnumValue , verbose_name = _ (u"enum group" ))
100103
101- def __unicode__ (self ):
104+ @python_2_unicode_compatible
105+ def __str__ (self ):
102106 return self .name
103107
104108
@@ -318,7 +322,8 @@ def save_value(self, entity, value):
318322 value_obj .value = value
319323 value_obj .save ()
320324
321- def __unicode__ (self ):
325+ @python_2_unicode_compatible
326+ def __str__ (self ):
322327 return u"%s.%s (%s)" % (self .content_type , self .name , self .get_datatype_display ())
323328
324329
@@ -401,7 +406,8 @@ def _set_value(self, new_value):
401406
402407 value = property (_get_value , _set_value )
403408
404- def __unicode__ (self ):
409+ @python_2_unicode_compatible
410+ def __str__ (self ):
405411 return u"%s - %s: \" %s\" " % (self .entity , self .attribute .name ,
406412 self .value )
407413
0 commit comments