Elgringo-
Your solution of using spaces instead of tabs to indent worked
perfectly!
Thank you for saving me additional hours of banging my head against
the wall!
On Jan 6, 7:06 pm, elgringo <[EMAIL PROTECTED]> wrote:
> I just go that to work after wrestling with that for the past day or
> two as well.
>
> Python uses indentation instead of braces to show levels of code. So,
> the line "class Admin: pass" needs to be only one level of indentation
> in from the top class declaration. So, your code should be more like
> this:
>
> from django.db import models
> class Poll(models.Model):
> question = models.CharField(maxlength=200)
> pub_date = models.DateTimeField('date published')
> class Admin: pass
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(maxlength=200)
> votes = models.IntegerField()
> class Admin: pass
>
> Otherwise it's gonna freak out.
>
> I was having problems with my text editor. For some reason Python
> didn't like the way it handled tabs/spaces. I stopped using tabs and
> started using spaces, and that seemed to fix the problem.
>
> Good luck.
>
> On Jan 6, 3:50 pm, Chris Phillips <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I am following the online tutorial and I am unable to add my app to
> > the admin section.
>
> > When I runserver I get:
> > mysite.polls: unexpected indent (models.py, line 5)
> > 1 error found
>
> > Here is my models.py:
>
> > from django.db import models
> > class Poll(models.Model):
> > question = models.CharField(maxlength=200)
> > pub_date = models.DateTimeField('date published')
> > class Admin: pass
>
> > class Choice(models.Model):
> > poll = models.ForeignKey(Poll)
> > choice = models.CharField(maxlength=200)
> > votes = models.IntegerField()
> > class Admin: pass
>
> > Am I doing something wrong?
>
> > Extra Info:
> > Using Windows XP
> > Django version 0.96
> > Using Notepad++ to edit files
>
> > Thanks!
>
> > Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---