On Jan 19, 2009, at 4:17 PM, jazz wrote:
>
> c:\projects\mysite>python manage.py sql polls
> Traceback (most recent call last):
> File "manage.py", line 11, in <module>
> execute_manager(settings)
> File "C:\Python25\Lib\site-packages\django\core\management
> \__init__.py", line 340, in execute_manager
> utility.execute()
> File "C:\Python25\Lib\site-packages\django\core\management
> \__init__.py", line 295, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
> File "C:\Python25\Lib\site-packages\django\core\management\base.py",
> line 195, in run_from_argv
> self.execute(*args, **options.__dict__)
> File "C:\Python25\Lib\site-packages\django\core\management\base.py",
> line 221, in execute
> self.validate()
> File "C:\Python25\Lib\site-packages\django\core\management\base.py",
> line 249, in validate
> num_errors = get_validation_errors(s, app)
> File "C:\Python25\lib\site-packages\django\core\management
> \validation.py", line 28, in get_validation_errors
> for (app_name, error) in get_app_errors().items():
> File "C:\Python25\lib\site-packages\django\db\models\loading.py",
> line 128, in get_app_errors
> self._populate()
> File "C:\Python25\lib\site-packages\django\db\models\loading.py",
> line 57, in _populate
> self.load_app(app_name, True)
> File "C:\Python25\lib\site-packages\django\db\models\loading.py",
> line 72, in load_app
> mod = __import__(app_name, {}, {}, ['models'])
> File "c:\projects\mysite\..\mysite\polls\models.py", line 4, in
> <module>
> class Poll(models.model):
> AttributeError: 'module' object has no attribute 'model'
>
Capitalization is important, you want to subclass models.Model, not
models.model.
That should do the trick,
Eric
> This is wat i did:
>
> from django.db import models
>
> # Create your models here.
> 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()
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---