У меня есть сайт в локальной системе разработки с использованием Streamfield и 2 пользовательских полей StructBlock. Работает нормально в 2.4, но после обновления до 2.5 я могу нормально создать страницу в админке, но когда я иду редактировать эту страницу в админке после сохранения, появляется ошибка. Я попытался с новой базой данных, но получил ту же ошибку. Передний конец страницы работает нормально.
- Начните новый проект с
wagtail start myproject
- Создание страницы потокового поля с настраиваемым полем StructBlock. (Возможно, даже просто встроенное поле, еще не проверяли.) Сохраните страницу.
- Попробуйте снова отредактировать страницу.
Я тоже пробовал с новой БД с такими же результатами. Есть идеи?
Вот трассировка:
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