1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Fixed #26816 -- Corrected an admin check to require inlines to subclass InlineModelAdmin.

This commit is contained in:
Berker Peksag 2016-08-25 00:34:32 +03:00 committed by Tim Graham
parent 3c97ba2a0d
commit 426bca002c
3 changed files with 5 additions and 5 deletions

View File

@ -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',
)

View File

@ -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``.

View File

@ -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):