首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Django管理问题

Django管理问题
EN

Stack Overflow用户
提问于 2011-11-01 05:06:17
回答 3查看 1.3K关注 0票数 1

当我尝试访问django管理默认应用程序时,我有以下堆栈跟踪。有人知道怎么修吗?我已经在我的models.py中为目录应用程序清楚地定义了字段date_created。我不确定我还需要在哪里定义它?

代码语言:javascript
复制
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
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-11-01 05:12:30

我的猜测是,您已经在models.py字段中设置了auto_now_addauto_add,因此它不是表单中要排除的一部分。

尝试从您的exclude语句中删除它。

票数 5
EN

Stack Overflow用户

发布于 2011-11-01 05:08:44

您是在初始syncdb之后进行更改的吗?如果是这样的话,您需要在有问题的应用程序上执行reset,以便删除、重新创建和(如果您有fixture)重新加载这些表。

或者,您可以进入您的应用程序的dbshell并使用SQL自己修改该表。

票数 0
EN

Stack Overflow用户

发布于 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时,这个问题马上就消失了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7959758

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档