我正在通过https://docs.djangoproject.com/en/1.4/intro/tutorial01/工作。
在本教程的最后是关于 django DB api 的部分,有以下内容:
# Display any choices from the related object set -- none so far.
>>> p.choice_set.all()
[]
# Create three choices.
>>> p.choice_set.create(choice_text='Not much', votes=0)
<Choice: Not much>
但是,当我直接从教程中复制: >>> p.choice_set.create(choice_text='Not much', votes=0) 时,我得到:
raise TypeError("'%s' is an invalid keyword argument for this function" % kw
args.keys()[0])
TypeError: 'choice_text' is an invalid keyword argument for this function
以前 tut 中的所有内容都按预期工作。
知道问题是什么吗?我对 python 很陌生,来自 php 背景,有一些 OOP 经验。
提前致谢,
账单