Skip to content

Commit d9a8211

Browse files
Merge pull request #457 from jorenham/fix-comments-panel-issue
fix crash with `WAGTAILADMIN_COMMENTS_ENABLED = False`
2 parents bc7c08f + 637f7e0 commit d9a8211

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

wagtail_modeltranslation/patch_wagtailadmin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ def _patch_panels(self, panels_list, related_model=None):
188188
if isinstance(panel, PanelPlaceholder):
189189
# Create an instance of the panel according to the specs of the placeholder
190190
real_panel = panel.construct()
191-
initiated_panels_list.append(real_panel)
191+
# `real_panel` will be none for the `CommentPanelPlaceholder` subclass if
192+
# `WAGTAILADMIN_COMMENTS_ENABLED = False` is set in the settings
193+
if real_panel is not None:
194+
initiated_panels_list.append(real_panel)
192195
elif isinstance(panel, str):
193196
field = current_patching_model._meta.get_field(panel)
194197
if isinstance(field, ManyToOneRel):

0 commit comments

Comments
 (0)