Ticket #8245: Misleading-AlreadyRegistered-03.diff
File Misleading-AlreadyRegistered-03.diff, 985 bytes (added by , 16 years ago) |
---|
-
django/contrib/admin/__init__.py
9 9 may want. 10 10 """ 11 11 import imp 12 import copy 12 13 from django.conf import settings 13 14 for app in settings.INSTALLED_APPS: 14 15 try: … … 16 17 except ImportError: 17 18 # there is no app admin.py, skip it 18 19 continue 19 __import__("%s.admin" % app) 20 try: 21 model_registry_before_import = copy.copy(site._registry) 22 __import__("%s.admin" % app) 23 except: 24 # Reset the model registry to the state before the last import as this import will have to reoccur 25 # on the next request and this could raise NotRegistered and AlreadyRegistered exceptions (see #8245). 26 site._registry = model_registry_before_import 27 raise