Ticket #8245: Misleading-AlreadyRegistered-00.diff
File Misleading-AlreadyRegistered-00.diff, 915 bytes (added by , 16 years ago) |
---|
-
django/contrib/admin/__init__.py
16 16 except ImportError: 17 17 # there is no app admin.py, skip it 18 18 continue 19 __import__("%s.admin" % app) 19 try: 20 models_registered_before_import = site._registry.keys() 21 __import__("%s.admin" % app) 22 except: 23 # Unregister the models that were registered in the last import as this import will have 24 # to reoccur on the next request and this would raise AlreadyRegistered exceptions (see #8245). 25 for model, admin_class in site._registry.items(): 26 if model not in models_registered_before_import: 27 site.unregister(model) 28 raise