mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[soc2009/multidb] Added backwards compatibility layer for contrib.gis. Patch from Russell Keith-Magee.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d5e883f2e3
commit
808aa3b89d
3
TODO
3
TODO
@ -4,9 +4,6 @@ Django Multiple Database TODO List
|
||||
Required for v1.2
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Finalize the sql.Query internals
|
||||
* Clean up the use of db.backend.query_class()
|
||||
* Verify it still works with GeoDjango
|
||||
* Modify the admin interface to support multiple databases (doh).
|
||||
|
||||
Optional for v1.2
|
||||
|
@ -36,12 +36,26 @@ if DEFAULT_DB_ALIAS not in settings.DATABASES:
|
||||
|
||||
for database in settings.DATABASES.values():
|
||||
if database['ENGINE'] in ("postgresql", "postgresql_psycopg2", "sqlite3", "mysql", "oracle"):
|
||||
database['ENGINE'] = "django.db.backends.%s" % database['ENGINE']
|
||||
import warnings
|
||||
warnings.warn(
|
||||
"Short names for DATABASE_ENGINE are deprecated; prepend with 'django.db.backends.'",
|
||||
PendingDeprecationWarning
|
||||
)
|
||||
if 'django.contrib.gis' in settings.INSTALLED_APPS:
|
||||
warnings.warn(
|
||||
"django.contrib.gis is now implemented as a full database backend.\n"
|
||||
"Modify DATABASE_ENGINE to select a backend from 'django.contrib.gis.db.backends'",
|
||||
PendingDeprecationWarning
|
||||
)
|
||||
if database['ENGINE'] == 'postgresql_psycopg2':
|
||||
full_engine = 'django.contrib.gis.db.backends.postgis'
|
||||
elif database['ENGINE'] == 'sqlite3':
|
||||
full_engine = 'django.contrib.gis.db.backends.spatialite'
|
||||
else:
|
||||
full_engine = 'django.contrib.gis.db.backends.%s' % database['ENGINE']
|
||||
else:
|
||||
warnings.warn(
|
||||
"Short names for DATABASE_ENGINE are deprecated; prepend with 'django.db.backends.'",
|
||||
PendingDeprecationWarning
|
||||
)
|
||||
full_engine = "django.db.backends.%s" % database['ENGINE']
|
||||
database['ENGINE'] = full_engine
|
||||
|
||||
connections = ConnectionHandler(settings.DATABASES)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user