Sunday, April 27, 2014

IndentationError :Unexpected Indent

 I have been following up on the tutorial on Python version 1.6 and I got stuck at an indentation error I can't seem to debug. Its under the first tutorial of creating Django application and I modified my polls\models.py file to look like this;

from django.db import models
import datetime
from django.utils import timezone

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_recently (self):
return self.pub_date > = timezone.now() - datetime.timedelta(days=1)

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)
def __unicode__(self):  
        return self.choice_text 

I keep getting an error at that line that starts with "def was_published_recently.." and can't seem to debug the error. Can anyone kindly help me here? I'm stuck. :( 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0e2ec62a-a7a5-4ebd-b639-975cc514e060%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment