Sure do: it should be __str__() with two underscores on either side, not one.
-Jeff On Dec 12, 7:33 am, ben852 <gervais....@gmail.com> wrote: > Hi, > I am new to django and programming. > I have a problem with the method _str_( ). > Following the tutorial, I edited my models.py file in mysite/books and > wrote: > > class Publisher(models.Model): > name = models.Charfield(max_length=30) > address = models.Charfield(max_length=30) > website = models.URLField() > > def _str_(self): > return self.name > > then python manage.py shell > > from books.models import Publisher > publisher_list = Publisher.objects.all ( ) > publisher_list > > [<Publisher : Publisher object>, <Publisher: Publisher object>] # > p1.save ( ) and p2.save ( ) > > The _str_ method doesn't work. > Do you have an idea? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---