waltbrad wrote: > Hate to bother with this, I'm sure it's a small thing. I'm going > through the 1st django app tutorial in the django documentation. I'm > doing okay until the Unicode statements they want inserted into the > models.py file, for the representation of objects in the interpreter. > > On the website they show this: > ============ > class Poll(models.Model): > # ... > def __unicode__(self): > return self.question > > class Choice(models.Model): > # ... > def __unicode__(self): > return self.choice > ============ > > But when I indent like that I get an error that reads: > > IndentationError: Expected an indented block. > > So, I take the indentations out of the def stmt. But when I do that > the representations are the same as they were before. So, at present > my models.py file looks like this: > ========================= > > # Create your models here. > from django.db import models > import datetime > > class Poll(models.Model): > question = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > def __unicode__(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(max_length=200) > votes = models.IntegerField() > def __unicode__(self): > return self.choice > ====================== > > Is there something wrong with this. I am using django 1.1 > Are you by any chance mixing spaces and tabs? The code *looks* OK. I doubt you are using 1.1, however, since that hasn't been released yet.
regards Steve --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---