gpt4 book ai didi

django-cms - 显示页面的高级设置时出现 Django CMS 错误

转载 作者:行者123 更新时间:2023-12-03 23:13:12 33 4
gpt4 key购买 nike

这是我在管理模式下尝试更改页面的高级设置时遇到的错误:

TypeError at /admin/cms/page/5/advanced-settings/
__str__ returned non-string (type __proxy__)

Environment:


Request Method: GET
Request URL: http://localhost:8000/admin/cms/page/5/advanced-settings/?language=en&cms_path=/

Django Version: 2.1.7
Python Version: 3.6.7
Installed Applications:
['djangocms_admin_style',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.messages',
'cms',
'menus',
'sekizai',
'treebeard',
'djangocms_text_ckeditor',
'filer',
'easy_thumbnails',
'djangocms_column',
'djangocms_file',
'djangocms_link',
'djangocms_picture',
'djangocms_style',
'djangocms_snippet',
'djangocms_googlemap',
'djangocms_video',
'structuresend']
Installed Middleware:
['cms.middleware.utils.ApphookReloadMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware']


Template error:
In template /usr/local/lib/python3.6/dist-packages/django/forms/templates/django/forms/widgets/select_option.html, error at line 1
__str__ returned non-string (type __proxy__)
1 : <option value="{{ widget.value|stringformat:'s' }}"{% include "django/forms/widgets/attrs.html" %}> {{ widget.label }} </option>
2 :

Traceback:

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py" in _get_response
156. response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py" in _get_response
154. response = response.render()

File "/usr/local/lib/python3.6/dist-packages/django/template/response.py" in render
106. self.content = self.rendered_content

File "/usr/local/lib/python3.6/dist-packages/django/template/response.py" in rendered_content
83. content = template.render(context, self._request)

File "/usr/local/lib/python3.6/dist-packages/django/template/backends/django.py" in render
61. return self.template.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
171. return self._render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py" in render
150. return compiled_parent._render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py" in render
150. return compiled_parent._render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py" in render
150. return compiled_parent._render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py" in render
62. result = block.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py" in render
209. nodelist.append(node.render_annotated(context))

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py" in render
188. return template.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
173. return self._render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py" in render
150. return compiled_parent._render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py" in render
209. nodelist.append(node.render_annotated(context))

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py" in render
209. nodelist.append(node.render_annotated(context))

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py" in render
309. return nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py" in render
309. return nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
993. return render_value_in_context(output, context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_value_in_context
972. value = str(value)

File "/usr/local/lib/python3.6/dist-packages/django/utils/html.py" in <lambda>
397. klass.__str__ = lambda self: mark_safe(klass_str(self))

File "/usr/local/lib/python3.6/dist-packages/django/forms/boundfield.py" in __str__
33. return self.as_widget()

File "/usr/local/lib/python3.6/dist-packages/django/forms/boundfield.py" in as_widget
93. renderer=self.form.renderer,

File "/usr/local/lib/python3.6/dist-packages/django/forms/widgets.py" in render
230. return self._render(self.template_name, context, renderer)

File "/usr/local/lib/python3.6/dist-packages/django/forms/widgets.py" in _render
235. return mark_safe(renderer.render(template_name, context))

File "/usr/local/lib/python3.6/dist-packages/django/forms/renderers.py" in render
31. return template.render(context, request=request).strip()

File "/usr/local/lib/python3.6/dist-packages/django/template/backends/django.py" in render
61. return self.template.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
171. return self._render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py" in render
209. nodelist.append(node.render_annotated(context))

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py" in render
209. nodelist.append(node.render_annotated(context))

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py" in render
188. return template.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
173. return self._render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in _render
163. return self.nodelist.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_annotated
904. return self.render(context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render
993. return render_value_in_context(output, context)

File "/usr/local/lib/python3.6/dist-packages/django/template/base.py" in render_value_in_context
972. value = str(value)

Exception Type: TypeError at /admin/cms/page/5/advanced-settings/
Exception Value: __str__ returned non-string (type __proxy__)

问题似乎是 value = str(value)不返回字符串,尽管据说值是“继承最近祖先的模板”。我不确定这里发生了什么。

显然它返回一个 __proxy__类型,根据其他问题,这是用于翻译的类型。我能做些什么来解决这个问题?我需要访问我的页面的设置来更改它使用的 html 模板。

最佳答案

我遇到了同样的问题——设置 I18N=True在我的 settings.py 中做到了。

如果这不起作用,请尝试 pip 安装 django-parler看看它是否有帮助。

关于django-cms - 显示页面的高级设置时出现 Django CMS 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55348268/

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