Initial commit of Gilbert, an advanced Django administration interface.
[philo.git] / contrib / gilbert / __init__.py
1 from philo.contrib.gilbert.sites import GilbertSite, site
2
3
4 def autodiscover():
5         import copy
6         from django.conf import settings
7         from django.utils.importlib import import_module
8         from django.utils.module_loading import module_has_submodule
9         
10         for app in settings.INSTALLED_APPS:
11                 mod = import_module(app)
12                 try:
13                         before_import_model_registry = copy.copy(site.model_registry)
14                         before_import_plugin_registry = copy.copy(site.plugin_registry)
15                         import_module('%s.gilbert' % app)
16                 except:
17                         site.model_registry = before_import_model_registry
18                         site.plugin_registry = before_import_plugin_registry
19                         
20                         if module_has_submodule(mod, 'gilbert'):
21                                 raise