mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Fixed #12540, #12541 -- Added database routers, allowing for configurable database use behavior in a multi-db setup, and improved error checking for cross-database joins.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
from django.conf import settings
|
||||
from django.core import signals
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.db.utils import ConnectionHandler, load_backend
|
||||
from django.db.utils import ConnectionHandler, ConnectionRouter, load_backend, DEFAULT_DB_ALIAS
|
||||
from django.utils.functional import curry
|
||||
|
||||
__all__ = ('backend', 'connection', 'connections', 'DatabaseError',
|
||||
__all__ = ('backend', 'connection', 'connections', 'router', 'DatabaseError',
|
||||
'IntegrityError', 'DEFAULT_DB_ALIAS')
|
||||
|
||||
DEFAULT_DB_ALIAS = 'default'
|
||||
|
||||
# For backwards compatibility - Port any old database settings over to
|
||||
# the new values.
|
||||
@@ -61,6 +60,7 @@ for alias, database in settings.DATABASES.items():
|
||||
|
||||
connections = ConnectionHandler(settings.DATABASES)
|
||||
|
||||
router = ConnectionRouter(settings.DATABASE_ROUTERS)
|
||||
|
||||
# `connection`, `DatabaseError` and `IntegrityError` are convenient aliases
|
||||
# for backend bits.
|
||||
|
||||
Reference in New Issue
Block a user