Ejemplo n.º 1
0
 def test_non_master_ready(self):
     """
     Tests the ready property of a registry other than the master.
     """
     apps = Apps()
     self.assertFalse(apps.ready)
     apps.populate_apps([])
     self.assertFalse(apps.ready)
     apps.populate_models()
     self.assertTrue(apps.ready)
Ejemplo n.º 2
0
    def check_dependencies(self):
        """
        Check that all things needed to run the admin have been correctly installed.

        The default implementation checks that admin and contenttypes apps are
        installed, as well as the auth context processor.
        """
        apps.populate_apps()
        if not apps.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 apps.has_app('django.contrib.contenttypes'):
            raise ImproperlyConfigured("Put 'django.contrib.contenttypes' in "
                "your INSTALLED_APPS setting in order to use the admin application.")
        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.")