summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-19 22:33:46 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-22 11:39:18 +0100
commit2239081ff16aab1eaafea003433f7139bf13e097 (patch)
tree373ddb3cf271c77d8baf0e4fd22fcc9f0d5f4d92 /django
parent9cdf1f6d547b6dffcee26f0a525429452551bb4a (diff)
Expurged INSTALLED_APPS from code and tests.
Except the app cache code and a few specific tests, of course.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/admin/sites.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
index 7b633bef89..a4caa863eb 100644
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -6,6 +6,7 @@ from django.contrib.auth import logout as auth_logout, REDIRECT_FIELD_NAME
from django.contrib.contenttypes import views as contenttype_views
from django.views.decorators.csrf import csrf_protect
from django.db.models.base import ModelBase
+from django.core.apps import app_cache
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.core.urlresolvers import reverse, NoReverseMatch
from django.template.response import TemplateResponse
@@ -156,20 +157,17 @@ class AdminSite(object):
"""
Check that all things needed to run the admin have been correctly installed.
- The default implementation checks that LogEntry, ContentType and the
- auth context processor are installed.
+ The default implementation checks that admin and contenttypes apps are
+ installed, as well as the auth context processor.
"""
- from django.contrib.admin.models import LogEntry
- from django.contrib.contenttypes.models import ContentType
-
- if not LogEntry._meta.installed:
+ app_cache.populate_apps()
+ if not app_cache.has_app('django.contrib.admin'):
raise ImproperlyConfigured("Put 'django.contrib.admin' in your "
"INSTALLED_APPS setting in order to use the admin application.")
- if not ContentType._meta.installed:
+ if not app_cache.has_app('django.contrib.contenttypes'):
raise ImproperlyConfigured("Put 'django.contrib.contenttypes' in "
"your INSTALLED_APPS setting in order to use the admin application.")
- if not ('django.contrib.auth.context_processors.auth' in settings.TEMPLATE_CONTEXT_PROCESSORS or
- 'django.core.context_processors.auth' in settings.TEMPLATE_CONTEXT_PROCESSORS):
+ if 'django.contrib.auth.context_processors.auth' not in settings.TEMPLATE_CONTEXT_PROCESSORS:
raise ImproperlyConfigured("Put 'django.contrib.auth.context_processors.auth' "
"in your TEMPLATE_CONTEXT_PROCESSORS setting in order to use the admin application.")