Total newbie here to Django and Python. Thanks for any insight.

1) I am working in TextMate and copied/pasted below code. In TextMate
the "def __str__(self)" is not indented from the pub_date line - it's
the same indent. I know indents are important - is there a way to set
up TextMate to show correct indentation? Or should I use a different
(Mac) editor? (I have to un-indent to not have a syntax error, but it
seems like it should be indented and the code doesn't execute
correctly).

2) Working through Part 1 of the 0.96 tutorial, I don't get expected
results when trying to add def __str__(self) to models.py.

class Poll(models.Model):
    question = models.CharField(maxlength=200)
    pub_date = models.DateTimeField('date published')
        def __str__(self):
                return self.question
        def was_published_today(self):
                return self.pub_date.date() == datetime.date.today()

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(maxlength=200)
    votes = models.IntegerField()
        def __str__(self):
                return self.choice

I get this returned in the shell:
>>> Poll.objects.all()
[<Poll: Poll object>]

When I would expect:
>>> Poll.objects.all()
[<Poll: What's up?>]

Any help greatly appreciated.
Rhett


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

Reply via email to