Author: jpellerin
Date: 2006-07-10 14:40:32 -0500 (Mon, 10 Jul 2006)
New Revision: 3315
Modified:
django/branches/multiple-db-support/django/core/management.py
django/branches/multiple-db-support/django/db/backends/ansi/sql.py
Log:
[multi-db] Updated django.core.management.get_sql_initial_data to use each
model's connection info. Removed unused style argument from
builder.get_initialdata.
Modified: django/branches/multiple-db-support/django/core/management.py
===================================================================
--- django/branches/multiple-db-support/django/core/management.py
2006-07-10 19:36:16 UTC (rev 3314)
+++ django/branches/multiple-db-support/django/core/management.py
2006-07-10 19:40:32 UTC (rev 3315)
@@ -373,15 +373,18 @@
def get_sql_initial_data(app):
"Returns a list of the initial INSERT SQL statements for the given app."
from django.db.models import get_models
- output = []
+ connection_output = {}
app_models = get_models(app)
- app_dir = os.path.normpath(os.path.join(os.path.dirname(app.__file__),
'sql'))
-
for klass in app_models:
- output.extend(get_sql_initial_data_for_model(klass))
+ opts = klass._meta
+ connection_name = opts.db_connection or _default
+ output = connection_output.setdefault(connection_name, [])
+ info = opts.connection_info
+ builder = info.get_creation_module().builder
+ output.extend(builder.get_initialdata(klass))
- return output
+ return _collate(connection_output)
get_sql_initial_data.help_doc = "Prints the initial INSERT SQL statements for
the given app name(s)."
get_sql_initial_data.args = APP_ARGS
@@ -414,10 +417,10 @@
def get_sql_indexes(app):
"Returns a list of the CREATE INDEX SQL statements for the given app."
- from django.db import models
+ from django.db.models import get_models
connection_output = {}
- for klass in models.get_models(app):
+ for klass in get_models(app):
opts = klass._meta
connection_name = opts.db_connection or _default
output = connection_output.setdefault(connection_name, [])
Modified: django/branches/multiple-db-support/django/db/backends/ansi/sql.py
===================================================================
--- django/branches/multiple-db-support/django/db/backends/ansi/sql.py
2006-07-10 19:36:16 UTC (rev 3314)
+++ django/branches/multiple-db-support/django/db/backends/ansi/sql.py
2006-07-10 19:40:32 UTC (rev 3315)
@@ -241,9 +241,7 @@
output.reverse()
return output
- def get_initialdata(self, model, style=None):
- if style is None:
- style = default_style
+ def get_initialdata(self, model):
opts = model._meta
info = opts.connection_info
settings = info.connection.settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---