On Mon, Jul 14, 2014 at 11:31 PM, Aeh. ABID <
aeh....@gmail.com> wrote:
>
> In your def __unicode__ convert the current returned int to string :
>
>> def __unicode__(self): # Python 3: def __str__(self):
>> return str(self.vm_id)
>
Stop, you are making my eyes bleed!
It is really fairly important that you return a unicode object from
the __unicode__ method and not a str object.
__unicode__ is the method that python calls when python wants to turn
your object in to a unicode representation of it. The method takes no
arguments, and the ONLY post-condition is that it returns a unicode
object - it should not be too taxing to get it right!
If you do not return a unicode object, strange and unpredictable
things can happen (like AttributeError("'int' object has no attribute
'encode'")).
Cheers
Tom