> Sure do:  it should be __str__() with two underscores on either side,
> not one.

And for the use-case the OP gave...

>> from books.models import Publisher
>> publisher_list = Publisher.objects.all ( )
>> publisher_list
>>
>> [<Publisher : Publisher object>, <Publisher: Publisher object>]  #


Python calls the __repr__ for the display at the command-line, 
not the __str__ (the str is used for prints:

   >>> print publisher_list # use the __str__ method
   [output]
   >>> publisher_list # uses the __repr__ method
   [output]

which is the same as

   >>> print repr(publisher_list)

-tim




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to