On Mon, Jul 14, 2014 at 11:31 PM, Aeh. ABID <[email protected]> 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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1%2B5mn3M5Wm-V3HOcLvtdaW%2Bqh4PELm8F6fq9Fo%3Dg-tzDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to