diff options
| author | Ian Kelly <ian.g.kelly@gmail.com> | 2011-04-21 17:43:22 +0000 |
|---|---|---|
| committer | Ian Kelly <ian.g.kelly@gmail.com> | 2011-04-21 17:43:22 +0000 |
| commit | 53678ef5083a20955e3f0192bbe9005cc7abbded (patch) | |
| tree | 6f1ec3da4b79b9fb168b725ed9c00883228c7a97 | |
| parent | 64995cdd63e01b6bf5372cec76c3fe1d2a3cff62 (diff) | |
[1.3.X] Refs #15573, #15850: Added a check for whether the sites app is installed when creating the test database, in order to work around a bug in get_model. Thanks to adsva and carljm.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16062 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/backends/creation.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py index 75f07926c1..57e3f7762d 100644 --- a/django/db/backends/creation.py +++ b/django/db/backends/creation.py @@ -379,9 +379,10 @@ class BaseDatabaseCreation(object): # default site may or may not be 1, depending on how the sequence was # reset. If the sites app is loaded, then we coerce it. from django.db.models import get_model - Site = get_model('sites', 'Site') - if Site is not None and Site.objects.using(self.connection.alias).count() == 1: - Site.objects.using(self.connection.alias).update(id=settings.SITE_ID) + if 'django.contrib.sites' in settings.INSTALLED_APPS: + Site = get_model('sites', 'Site') + if Site is not None and Site.objects.using(self.connection.alias).count() == 1: + Site.objects.using(self.connection.alias).update(id=settings.SITE_ID) from django.core.cache import get_cache from django.core.cache.backends.db import BaseDatabaseCache |
