Re: tutorial __str__() method not working

2008-03-26 Thread Erik Vorhes
It looks like the issue is one of indentation. There's nothing for "self" to refer to if the method isn't part of the class. --And you're probably better off using __unicode__ than __str__ Try: class Poll(models.Model): question = models.CharField(max_length=200) pub_date = models.DateF

Re: tutorial __str__() method not working

2008-03-26 Thread Evert Rol
> I'm just going through the mysite tutorial and can't seem to get the > __str__() method to work when adding it to the two classes, I still > get []. > > polls/models.py: > > from django.db import models > import datetime > > class Poll(models.Model): >question = models.CharField(maxlength=20

Re: tutorial __str__() method not working

2008-03-26 Thread Tim Sawyer
Looks like your indentation is wrong (assuming it's not just a copy/paste issue). Remember python code needs to be indented correctly in order to work. Your def __str__(self): line needs to start at the same indentation as the attributes (question/pub_date) inside your class. Tim. On Wednes

tutorial __str__() method not working

2008-03-26 Thread [EMAIL PROTECTED]
Hello, I'm just going through the mysite tutorial and can't seem to get the __str__() method to work when adding it to the two classes, I still get []. polls/models.py: from django.db import models import datetime class Poll(models.Model): question = models.CharField(maxlength=200) pub