diff --git a/wagtail/utils/compat.py b/wagtail/utils/compat.py index 78c9c9744e..c8acdfb658 100644 --- a/wagtail/utils/compat.py +++ b/wagtail/utils/compat.py @@ -1,5 +1,11 @@ +import django + + def get_related_model(rel): # In Django 1.7 and under, the related model is accessed by doing: rel.model # This was renamed in Django 1.8 to rel.related_model. rel.model now returns # the base model. - return getattr(rel, 'related_model', rel.model) + if django.VERSION >= (1, 8): + return rel.related_model + else: + return rel.model