Author: ikelly
Date: 2011-04-21 10:43:22 -0700 (Thu, 21 Apr 2011)
New Revision: 16062

Modified:
   django/branches/releases/1.3.X/django/db/backends/creation.py
Log:
[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.

Modified: django/branches/releases/1.3.X/django/db/backends/creation.py
===================================================================
--- django/branches/releases/1.3.X/django/db/backends/creation.py       
2011-04-21 00:00:32 UTC (rev 16061)
+++ django/branches/releases/1.3.X/django/db/backends/creation.py       
2011-04-21 17:43:22 UTC (rev 16062)
@@ -379,9 +379,10 @@
         # 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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to