Django管理后台问题
我在尝试访问Django的默认管理后台时,遇到了以下错误信息。有没有人知道怎么解决这个问题?我在我的catalog应用的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
3 个回答
0
我遇到了同样的错误。我回到一个有一段时间没碰的项目,结果发现我用的是 django==1.5
,而之前这个项目是用 django==1.6
运行的。
简单来说,我的问题就是和 1.5
这个版本的 django 有关。我收到的错误信息是:ExhibitorAdmin.exclude' 指向一个表单中缺失的字段 'collectedcontact'。
但是,当我切换到 django==1.6
后,这个问题立刻就消失了。
0
你是在第一次运行syncdb
之后才做的修改吗?如果是这样的话,你需要对相关的应用进行reset
,这样才能把表删掉、重新创建,并且(如果你有数据文件的话)重新加载这些数据。
另外,你也可以直接进入你应用的dbshell
,用SQL语句自己来修改表。
5
我猜是因为你在 models.py
文件里的某个字段设置了 auto_now_add
或 auto_add
,所以这个字段根本就不在你的表单里,没法被排除。
试着把它从你的排除列表中去掉吧。