Fixed #26961 -- Made admin checks run when DEBUG=False.

This commit is contained in:
Adam Chainz 2016-07-27 11:10:24 +01:00 committed by Tim Graham
parent d57ecf40eb
commit 9daf8c43bd
2 changed files with 0 additions and 7 deletions

View File

@ -2,7 +2,6 @@ from functools import update_wrapper
from weakref import WeakSet from weakref import WeakSet
from django.apps import apps from django.apps import apps
from django.conf import settings
from django.contrib.admin import ModelAdmin, actions from django.contrib.admin import ModelAdmin, actions
from django.contrib.auth import REDIRECT_FIELD_NAME from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
@ -71,9 +70,6 @@ class AdminSite(object):
Run the system checks on all ModelAdmins, except if they aren't Run the system checks on all ModelAdmins, except if they aren't
customized at all. customized at all.
""" """
if not settings.DEBUG:
return []
if app_configs is None: if app_configs is None:
app_configs = apps.get_app_configs() app_configs = apps.get_app_configs()
app_configs = set(app_configs) # Speed up lookups below app_configs = set(app_configs) # Speed up lookups below

View File

@ -45,7 +45,6 @@ class MyAdmin(admin.ModelAdmin):
) )
class SystemChecksTestCase(SimpleTestCase): class SystemChecksTestCase(SimpleTestCase):
@override_settings(DEBUG=True)
def test_checks_are_performed(self): def test_checks_are_performed(self):
admin.site.register(Song, MyAdmin) admin.site.register(Song, MyAdmin)
try: try:
@ -93,7 +92,6 @@ class SystemChecksTestCase(SimpleTestCase):
] ]
self.assertEqual(errors, expected) self.assertEqual(errors, expected)
@override_settings(DEBUG=True)
def test_custom_adminsite(self): def test_custom_adminsite(self):
class CustomAdminSite(admin.AdminSite): class CustomAdminSite(admin.AdminSite):
pass pass
@ -107,7 +105,6 @@ class SystemChecksTestCase(SimpleTestCase):
finally: finally:
custom_site.unregister(Song) custom_site.unregister(Song)
@override_settings(DEBUG=True)
def test_allows_checks_relying_on_other_modeladmins(self): def test_allows_checks_relying_on_other_modeladmins(self):
class MyBookAdmin(admin.ModelAdmin): class MyBookAdmin(admin.ModelAdmin):
def check(self, **kwargs): def check(self, **kwargs):