1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[soc2009/multidb] Raise a ConnectionDoesNotExist exception, instead of a KeyError for an invaid connection

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11424 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor
2009-08-09 21:53:57 +00:00
parent fde0bfe929
commit 1cbe183ff7
2 changed files with 10 additions and 3 deletions

View File

@@ -23,7 +23,9 @@ settings for that specific connection. The settings in the inner dictionaries
are described fully in the :settings:`DATABASES` documentation. The important
thing to note is that your primary database should have the alias
``'default'``, and any additional databases you have can have whatever alias
you choose.
you choose. If at any time you attempt to access a database that isn't defined
in your :settings:`DATABASES` setting then Django will raise a
``django.db.utils.ConnectionDoesNotExist`` exception.
Selecting a Database for a ``Model``
====================================
@@ -62,4 +64,4 @@ keyword argument to ``save()``. For example if you were migrating a user from
the ``'legacy_users'`` database to the ``'new_users'`` database you might do::
>>> user_obj.save(using='new_users')
>>> usre_obj.delete(using='legacy_users')
>>> user_obj.delete(using='legacy_users')