diff --git a/wagtail/admin/edit_handlers.py b/wagtail/admin/edit_handlers.py index ccf7267973..66d17130d1 100644 --- a/wagtail/admin/edit_handlers.py +++ b/wagtail/admin/edit_handlers.py @@ -648,14 +648,14 @@ class InlinePanel(EditHandler): return self.panels # Failing that, get it from the model return extract_panel_definitions_from_model_class( - self.related.related_model, - exclude=[self.related.field.name] + self.db_field.related_model, + exclude=[self.db_field.field.name] ) def get_child_edit_handler(self): panels = self.get_panel_definitions() child_edit_handler = MultiFieldPanel(panels, heading=self.heading) - return child_edit_handler.bind_to_model(self.related.related_model) + return child_edit_handler.bind_to_model(self.db_field.related_model) def required_formsets(self): child_edit_handler = self.get_child_edit_handler() @@ -678,7 +678,7 @@ class InlinePanel(EditHandler): for panel in self.get_panel_definitions(): field_comparisons.extend( - panel.bind_to_model(self.related.related_model) + panel.bind_to_model(self.db_field.related_model) .get_comparison()) return [curry(compare.ChildRelationComparison, self.db_field, @@ -687,7 +687,6 @@ class InlinePanel(EditHandler): def on_model_bound(self): manager = getattr(self.model, self.relation_name) self.db_field = manager.rel - self.related = manager.rel def on_instance_bound(self): self.formset = self.form.formsets[self.relation_name]