__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>]

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