当我尝试访问django管理默认应用程序时,我有以下堆栈跟踪。有人知道怎么修吗?我已经在我的models.py中为目录应用程序清楚地定义了字段date_created。我不确定我还需要在哪里定义它?
ImproperlyConfigured at /admin
'ProductAdmin.exclude' refers to field 'date_created' that is missing from the form.
Request Method: GET
Request URL: http://localhost:8000/admin
Django Version: 1.3.1
Exception Type: ImproperlyConfigured
Exception Value:
'ProductAdmin.exclude' refers to field 'date_created' that is missing from the form.
Exception Location: /Library/Python/2.6/site-packages/django/contrib/admin/validation.py in check_formfield, line 362
Python Executable: /usr/bin/python
Python Version: 2.6.1
Python Path:
['/Users/christopherfarm/Desktop/ecomstore',
'/Library/Python/2.6/site-packages/python_dateutil-1.5-py2.6.egg',
'/Library/Python/2.6/site-packages/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg',
'/Library/Python/2.6/site-packages/django_db_log-2.2.1-py2.6.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
'/Library/Python/2.6/site-packages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
Server time: Mon, 31 Oct 2011 16:02:11 -0500发布于 2011-11-01 05:12:30
我的猜测是,您已经在models.py字段中设置了auto_now_add或auto_add,因此它不是表单中要排除的一部分。
尝试从您的exclude语句中删除它。
发布于 2011-11-01 05:08:44
您是在初始syncdb之后进行更改的吗?如果是这样的话,您需要在有问题的应用程序上执行reset,以便删除、重新创建和(如果您有fixture)重新加载这些表。
或者,您可以进入您的应用程序的dbshell并使用SQL自己修改该表。
发布于 2014-05-06 06:37:50
我也犯了同样的错误。我回到了我有一段时间没有处理的项目上。我用django==1.5而不是django==1.6来运行它,因为它可以正常工作。
所以总而言之,在我的例子中,它是与1.5上的django版本连接的,我得到的错误如下:ExhibitorAdmin.exclude' refers to field 'collectedcontact' that is missing from the form.
然而,当我切换到django==1.6时,这个问题马上就消失了。
https://stackoverflow.com/questions/7959758
复制相似问题