我在本地开发人员中有一个使用Streamfield和2个自定义StructBlock字段的站点。在2.4中可以正常工作,但是升级到2.5后,我可以在管理员中创建页面,但是当我在保存后去编辑该页面时出现错误。我也尝试了一个新的数据库,但是遇到了同样的错误。页面的前端工作正常。
wagtail start myproject
我也尝试过使用具有相同结果的新数据库。有什么想法吗?
这是回溯:
Template error:
In template /Users/nas/env/lib/python3.7/site-packages/wagtail/admin/templates/wagtailadmin/block_forms/stream_member.html, error at line 1
list index out of range
1 : {% extends "wagtailadmin/block_forms/sequence_member.html" %}
2 : {% load i18n %}
3 :
4 : {% block hidden_fields %}
5 : <input type="hidden" id="{{ prefix }}-type" name="{{ prefix }}-type" value="{{ child.block.name }}">
6 : <input type="hidden" id="{{ prefix }}-id" name="{{ prefix }}-id" value="{{ block_id|default:"" }}">
7 : {% endblock %}
8 :
9 : {% block header_controls %}
10 : <div class="sequence-controls">
11 : <h3><label{% if child.id_for_label %} for="{{ child.id_for_label }}"{% endif %}>{{ child.block.label }}</label></h3>
Traceback:
File "/Users/nas/env/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/Users/nas/env/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)
File "/Users/nas/env/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/nas/env/lib/python3.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/admin/urls/__init__.py" in wrapper
102. return view_func(request, *args, **kwargs)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/admin/decorators.py" in decorated_view
34. return view_func(request, *args, **kwargs)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/admin/views/pages.py" in edit
539. 'has_unsaved_changes': has_unsaved_changes,
File "/Users/nas/env/lib/python3.7/site-packages/django/shortcuts.py" in render
36. content = loader.render_to_string(template_name, context, request, using=using)
File "/Users/nas/env/lib/python3.7/site-packages/django/template/loader.py" in render_to_string
62. return template.render(context, request)
File "/Users/nas/env/lib/python3.7/site-packages/django/template/backends/django.py" in render
61. return self.template.render(context)
File "/Users/nas/env/lib/python3.7/site-packages/django/template/base.py" in render
171. return self._render(context)
File "/Users/nas/env/lib/python3.7/site-packages/django/test/utils.py" in instrumented_test_render
95. template_rendered.send(sender=self, template=self, context=context)
File "/Users/nas/env/lib/python3.7/site-packages/django/dispatch/dispatcher.py" in send
175. for receiver in self._live_receivers(sender)
File "/Users/nas/env/lib/python3.7/site-packages/django/dispatch/dispatcher.py" in <listcomp>
175. for receiver in self._live_receivers(sender)
File "/Users/nas/env/lib/python3.7/site-packages/debug_toolbar/panels/templates/panel.py" in _store_template_info
157. pformatted = force_text(pformat(temp_layer))
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pprint.py" in pformat
58. compact=compact).pformat(object)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pprint.py" in pformat
144. self._format(object, sio, 0, 0, {}, 0)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pprint.py" in _format
161. rep = self._repr(object, context, level)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pprint.py" in _repr
393. self._depth, level)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pprint.py" in format
405. return _safe_repr(object, context, maxlevels, level)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pprint.py" in _safe_repr
514. vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level)
File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pprint.py" in _safe_repr
555. rep = repr(object)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/admin/edit_handlers.py" in __repr__
188. self.model, self.instance, self.request, self.form)
File "/Users/nas/env/lib/python3.7/site-packages/django/utils/html.py" in <lambda>
397. klass.__str__ = lambda self: mark_safe(klass_str(self))
File "/Users/nas/env/lib/python3.7/site-packages/django/forms/forms.py" in __str__
142. return self.as_table()
File "/Users/nas/env/lib/python3.7/site-packages/django/forms/forms.py" in as_table
284. errors_on_separate_row=False,
File "/Users/nas/env/lib/python3.7/site-packages/django/forms/forms.py" in _html_output
243. 'field_name': bf.html_name,
File "/Users/nas/env/lib/python3.7/site-packages/django/utils/html.py" in <lambda>
397. klass.__str__ = lambda self: mark_safe(klass_str(self))
File "/Users/nas/env/lib/python3.7/site-packages/django/forms/boundfield.py" in __str__
33. return self.as_widget()
File "/Users/nas/env/lib/python3.7/site-packages/django/forms/boundfield.py" in as_widget
93. renderer=self.form.renderer,
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/core/blocks/base.py" in render
505. return self.render_with_errors(name, value, attrs=attrs, errors=None, renderer=renderer)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/core/blocks/base.py" in render_with_errors
502. return mark_safe(bound_block.render_form() + js_snippet)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/core/blocks/base.py" in render_form
417. return self.block.render_form(self.value, self.prefix, errors=self.errors)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/core/blocks/stream_block.py" in render_form
141. for (i, child) in enumerate(valid_children)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/core/blocks/stream_block.py" in <listcomp>
141. for (i, child) in enumerate(valid_children)
File "/Users/nas/env/lib/python3.7/site-packages/wagtail/core/blocks/stream_block.py" in render_list_member
78. 'block_id': id,
File "/Users/nas/env/lib/python3.7/site-packages/django/template/loader.py" in render_to_string
62. return template.render(context, request)
File "/Users/nas/env/lib/python3.7/site-packages/django/template/backends/django.py" in render
61. return self.template.render(context)
File "/Users/nas/env/lib/python3.7/site-packages/django/template/base.py" in render
171. return self._render(context)
File "/Users/nas/env/lib/python3.7/site-packages/django/test/utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "/Users/nas/env/lib/python3.7/site-packages/django/template/base.py" in render
937. bit = node.render_annotated(context)
File "/Users/nas/env/lib/python3.7/site-packages/django/template/base.py" in render_annotated
904. return self.render(context)
File "/Users/nas/env/lib/python3.7/site-packages/django/template/loader_tags.py" in render
150. return compiled_parent._render(context)
File "/Users/nas/env/lib/python3.7/site-packages/django/test/utils.py" in instrumented_test_render
95. template_rendered.send(sender=self, template=self, context=context)
File "/Users/nas/env/lib/python3.7/site-packages/django/dispatch/dispatcher.py" in send
175. for receiver in self._live_receivers(sender)
File "/Users/nas/env/lib/python3.7/site-packages/django/dispatch/dispatcher.py" in <listcomp>
175. for receiver in self._live_receivers(sender)
File "/Users/nas/env/lib/python3.7/site-packages/debug_toolbar/panels/templates/panel.py" in _store_template_info
107. pformatted = self.pformat_layers[index]
Exception Type: IndexError at /admin/pages/4/edit/
Exception Value: list index out of range