From 5cf2bede965f826a68743f36dcef16a929ef18e7 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 21 Dec 2009 19:31:13 +0000 Subject: [PATCH] [soc2009/multidb] Fixed a problem with overzealous purging of contenttypes during syncdb. Patch from Russell Keith-Magee. git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11933 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/contenttypes/management.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/contrib/contenttypes/management.py b/django/contrib/contenttypes/management.py index d2fcbfbd3b..61ee28548b 100644 --- a/django/contrib/contenttypes/management.py +++ b/django/contrib/contenttypes/management.py @@ -7,10 +7,10 @@ def update_contenttypes(app, created_models, verbosity=2, **kwargs): Creates content types for models in the given app, removing any model entries that no longer have a matching model class. """ - ContentType.objects.clear_cache() - content_types = list(ContentType.objects.filter(app_label=app.__name__.split('.')[-2])) - app_models = get_models(app) db = kwargs['db'] + ContentType.objects.clear_cache() + content_types = list(ContentType.objects.using(db).filter(app_label=app.__name__.split('.')[-2])) + app_models = get_models(app) if not app_models: return for klass in app_models: