我正在尝试将我的Django管理面板与django-fluent-dashbaord集成,因此我在文档中执行以下操作: https://django-fluent-dashboard.readthedocs.org/en/latest/installation.html
之后我尝试启动管理面板我收到错误:
KeyError at /admin/
'request'
Request Method: GET
Request URL: http://localhost:8000/admin/
Django Version: 1.5.1
Exception Type: KeyError
Exception Value:
'request'
Exception Location: C:\Users\Grzegorz\Documents\VEnvs\XXX\lib\site-packages\django\template\context.py in __getitem__, line 57
Python Executable: C:\Users\Grzegorz\Documents\VEnvs\XXX\Scripts\python.exe
Python Version: 2.7.3
...
模板渲染期间出错
In template C:\Users\Grzegorz\Documents\VEnvs\XXX\lib\site-packages\admin_tools\menu\templates\admin\base_site.html, error at line 22
request
12 {% endif %}
13 {% endblock %}
14
15 {% block branding %}
16 <h1 id="site-name">{% trans 'Django administration' %}</h1>
17 {% endblock %}
18
19 {% block nav-global %}
20 {% if user.is_active and user.is_staff %}
21 {% if not is_popup %}
22 {% admin_tools_render_menu %}
23 {% endif %}
24 {% endif %}
25 {% endblock %}
26
你有什么建议可能是这个问题的原因吗?
答案 0 :(得分:1)
当我忘记在“TEMPLATE_CONTEXT_PROCESSORS”中添加“django.core.context_processors.request”时,我在django-admin-tool中遇到了类似的问题, 也许它会给你一些帮助
答案 1 :(得分:0)
就我而言,这解决了我的问题
private void validateFields (String id, ConsumerDO ci, FieldSet fieldset_p) throws Exception
{try {
ci.setCaption(fieldset_p.readString("newCaption"));
}
catch (Exception e) {
}
}