__unicode__

is for displaying objects.

———–

For example,

>>>p = Card.objects.create(name=’Hot Pot’, city=’San Diego’)

>>>card_list = Card.objects.all()

>>>card_list

[<Card: Card object>]

without __unicode__, you will see just “Card object”

if you define __unicode__

def __unicode__(self):

return self.name

then, you will see

[<Card: Hot Pot>]

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 Web Oom Suffusion theme by Sayontan Sinha
Switch to our mobile site
Top Footer