Ticket #16828: 16828.diff
File 16828.diff, 1.5 KB (added by , 13 years ago) |
---|
-
django/db/backends/creation.py
old new 374 374 verbosity=max(verbosity - 1, 0), 375 375 interactive=False, 376 376 database=self.connection.alias) 377 377 378 378 # One effect of calling syncdb followed by flush is that the id of the 379 379 # default site may or may not be 1, depending on how the sequence was 380 380 # reset. If the sites app is loaded, then we coerce it. 381 381 from django.db.models import get_model 382 from django.db import router 382 383 if 'django.contrib.sites' in settings.INSTALLED_APPS: 383 384 Site = get_model('sites', 'Site') 384 if Site is not None and Site.objects.using(self.connection.alias).count() == 1: 385 if (Site is not None 386 and router.allow_syncdb(self.connection.alias, Site) 387 and Site.objects.using(self.connection.alias).count() == 1): 385 388 Site.objects.using(self.connection.alias).update(id=settings.SITE_ID) 386 389 387 390 from django.core.cache import get_cache … … 389 392 for cache_alias in settings.CACHES: 390 393 cache = get_cache(cache_alias) 391 394 if isinstance(cache, BaseDatabaseCache): 392 from django.db import router393 395 if router.allow_syncdb(self.connection.alias, cache.cache_model_class): 394 396 call_command('createcachetable', cache._table, database=self.connection.alias) 395 397