Django 1.8 support in edit handlers

This commit is contained in:
Karl Hobley 2015-03-15 21:54:13 +00:00 committed by Matt Westcott
parent 4f2affcb60
commit 012209cc24

View file

@ -6,7 +6,7 @@ import warnings
from six import text_type
from modelcluster.forms import ClusterForm, ClusterFormMetaclass
from modelcluster.models import get_related_model
from django.db import models
from django.template.loader import render_to_string
@ -584,7 +584,7 @@ class BaseInlinePanel(EditHandler):
return cls.panels
# Failing that, get it from the model
else:
return extract_panel_definitions_from_model_class(cls.related.model, exclude=[cls.related.field.name])
return extract_panel_definitions_from_model_class(get_related_model(cls.related), exclude=[cls.related.field.name])
_child_edit_handler_class = None
@ -592,7 +592,7 @@ class BaseInlinePanel(EditHandler):
def get_child_edit_handler_class(cls):
if cls._child_edit_handler_class is None:
panels = cls.get_panel_definitions()
cls._child_edit_handler_class = MultiFieldPanel(panels, heading=cls.heading).bind_to_model(cls.related.model)
cls._child_edit_handler_class = MultiFieldPanel(panels, heading=cls.heading).bind_to_model(get_related_model(cls.related))
return cls._child_edit_handler_class