在/'ClientEventLogAdmin.exclude'中配置不正确是指表单中缺少的“已创建”字段

时间:2013-02-07 12:24:17

标签: python django

我正在安装一个django应用程序模块。我收到此错误。 我启动了另一个MicroInstance并重新安装了一切,但我仍然收到此错误。

Environment:


Request Method: GET
Request URL: http://54.235.127.252/mds/

Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['sana.mrs',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'sana.mrs.util.LoggingMiddleware')


Traceback:
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  101.                             request.path_info)
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in resolve
  250.             for pattern in self.url_patterns:
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in _get_url_patterns
  279.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py" in _get_urlconf_module
  274.             self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/opt/sana/urls.py" in <module>
  12. admin.autodiscover()
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/__init__.py" in autodiscover
  26.             import_module('%s.admin' % app)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/opt/sana/mrs/admin.py" in <module>
  26. admin.site.register(ClientEventLog, ClientEventLogAdmin)
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in register
  97.             validate(admin_class, model)
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/validation.py" in validate
  24.     validate_base(cls, model)
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/validation.py" in validate_base
  279.             check_formfield(cls, model, opts, 'exclude', field)
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/validation.py" in check_formfield
  369.                 "is missing from the form." % (cls.__name__, label, field))

Exception Type: ImproperlyConfigured at /
Exception Value: 'ClientEventLogAdmin.exclude' refers to field 'created' that is missing from the form.

注意:我只需要安装这个应用程序。我是python中的中间件。在Django中是初学者。但是在PHP,mysql和jQuery前端的专业人员

1 个答案:

答案 0 :(得分:0)

从我看到的,问题很可能与moca框架有关。

如果您的/opt/sana/mrs/admin.py文件看起来像this,那么罪魁祸首很可能位于line 12created字段是在排除列表中引用的,但之前没有定义

由于我不确定您的需求,您可以尝试一些解决方案:

  • 重新安装或更新您的moca框架字;
  • 在执行定义之前添加一段代码(不知道它应该是什么类型):

    from django.db import models # You may also place it in the top of the file
    created = models.DateField(blank=True, null=True)
    
  • created列表中删除exclude项目(虽然不确定影响)

希望它有所帮助,