gpt4 book ai didi

python - Django 管理员问题

转载 作者:太空宇宙 更新时间:2023-11-04 09:17:05 25 4
gpt4 key购买 nike

尝试访问 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

最佳答案

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

尝试将其从排除语句中删除。

关于python - Django 管理员问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7959758/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com