rktur...@gmail.com wrote:

> I'll keep this as short as possible. When I input  python manage.py sql 
> polls, i get the following
> error:
>  
> C:\Python27\Lib\site-packages\django\bin\mysite>python manage.py sql pol
> Traceback (most recent call last):
>   File "manage.py", line 10, in <module>
>     execute_from_command_line(sys.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py
> 443, in execute_from_command_line
>     utility.execute()
>   File "C:\Python27\lib\site-packages\django\core\management\__init__.py
> 382, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in execute
>     self.validate()
>   File "C:\Python27\lib\site-packages\django\core\management\base.py", l
>  in validate
>     num_errors = get_validation_errors(s, app)
>   File "C:\Python27\lib\site-packages\django\core\management\validation.
> e 30, in get_validation_errors
>     for (app_name, error) in get_app_errors().items():
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
>  get_app_errors
>     self._populate()
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
> _populate
>     self.load_app(app_name, True)
>   File "C:\Python27\lib\site-packages\django\db\models\loading.py", line
> load_app
>     models = import_module('.models', app_name)
>   File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 3
> port_module
>     __import__(name)
>   File "C:\Python27\Lib\site-packages\django\bin\mysite\polls\models.py"
> 0
>     votes = models.IntergerField()
>                                  ^
> IndentationError: unindent does not match any outer indentation level
> 
> So here is my settings.py "Installed apps" 
> 
> INSTALLED_APPS = (
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.sites',
>     'django.contrib.messages',
>     'django.contrib.staticfiles',
>     # Uncomment the next line to enable the admin:
>     # 'django.contrib.admin',
>     # Uncomment the next line to enable admin documentation:
>     # 'django.contrib.admindocs',
> 'polls',
> )
> 
> And here is my models.py:
> 
> from django.db import models
> 
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
>     votes = models.IntergerField()
> 

In python, indentation matters. Also, spelling matters just as much as
it does in other languages: IntergerField should be IntegerField. Try:

--8<---------------cut here---------------start------------->8---
class Poll(models.Model):
      question = models.CharField(max_length=200)
      pub_date = models.DateTimeField('date published')

class Choice(models.Model):
      poll = models.ForeignKey(Poll)
      choice = models.CharField(max_length=200)
      votes = models.IntegerField()
--8<---------------cut here---------------end--------------->8---

Nick

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to