【发布时间】:2013-01-21 07:58:45
【问题描述】:
C:\mysite>python manage.py shell
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from polls.models import Poll,Choice
>>> Poll.objects.all()
[]
>>> import django
>>> from django.utils import timezone
>>> p= Poll(question="what's new?",pub_date= timezone.now())
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 367, in __init__
raise TypeError("'%s'is an invalid keyword argument for
this function"%kwargs.keys() [0])
TypeError: 'pub_date' is an invalid keyword argument for this function
【问题讨论】:
-
你能展示一下你的 Poll 类的代码吗?是否有字段
pub_date?
标签: python django web-applications web-application-design