From 426bca002c7902ceae230e0ce08a76dd6b6d3a06 Mon Sep 17 00:00:00 2001 From: Berker Peksag <berker.peksag@gmail.com> Date: Thu, 25 Aug 2016 00:34:32 +0300 Subject: [PATCH] Fixed #26816 -- Corrected an admin check to require inlines to subclass InlineModelAdmin. --- django/contrib/admin/checks.py | 6 +++--- docs/ref/checks.txt | 2 +- tests/modeladmin/tests.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py index 609945177b..d61ce723e3 100644 --- a/django/contrib/admin/checks.py +++ b/django/contrib/admin/checks.py @@ -561,12 +561,12 @@ class ModelAdminChecks(BaseModelAdminChecks): """ Check one inline model admin. """ inline_label = '.'.join([inline.__module__, inline.__name__]) - from django.contrib.admin.options import BaseModelAdmin + from django.contrib.admin.options import InlineModelAdmin - if not issubclass(inline, BaseModelAdmin): + if not issubclass(inline, InlineModelAdmin): return [ checks.Error( - "'%s' must inherit from 'BaseModelAdmin'." % inline_label, + "'%s' must inherit from 'InlineModelAdmin'." % inline_label, obj=obj.__class__, id='admin.E104', ) diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt index 82f3c19228..78d3783b59 100644 --- a/docs/ref/checks.txt +++ b/docs/ref/checks.txt @@ -362,7 +362,7 @@ with the admin site: * **admin.E102**: The value of ``save_on_top`` must be a boolean. * **admin.E103**: The value of ``inlines`` must be a list or tuple. * **admin.E104**: ``<InlineModelAdmin class>`` must inherit from - ``BaseModelAdmin``. + ``InlineModelAdmin``. * **admin.E105**: ``<InlineModelAdmin class>`` must have a ``model`` attribute. * **admin.E106**: The value of ``<InlineModelAdmin class>.model`` must be a ``Model``. diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index d19093334a..d375090151 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -1339,7 +1339,7 @@ class InlinesCheckTests(CheckTestCase): self.assertIsInvalidRegexp( ValidationTestModelAdmin, ValidationTestModel, - r"'.*\.ValidationTestInline' must inherit from 'BaseModelAdmin'\.", + r"'.*\.ValidationTestInline' must inherit from 'InlineModelAdmin'\.", 'admin.E104') def test_missing_model_field(self):