Author: russellm
Date: 2010-02-26 05:26:41 -0600 (Fri, 26 Feb 2010)
New Revision: 12597
Modified:
django/trunk/django/core/management/commands/syncdb.py
Log:
Fixed #12712 -- Corrected a problem with synchronizing that prevented m2m
tables from being created under certain circumstances. Thanks to IonelMaries
for the report, and Alex Gaynor for the patch.
Modified: django/trunk/django/core/management/commands/syncdb.py
===================================================================
--- django/trunk/django/core/management/commands/syncdb.py 2010-02-26
11:12:14 UTC (rev 12596)
+++ django/trunk/django/core/management/commands/syncdb.py 2010-02-26
11:26:41 UTC (rev 12597)
@@ -63,18 +63,23 @@
if router.allow_syncdb(db, m)])
for app in models.get_apps()
)
+ def model_installed(model):
+ opts = model._meta
+ converter = connection.introspection.table_name_converter
+ return not ((converter(opts.db_table) in tables) or
+ (opts.auto_created and
converter(opts.auto_created._meta.db_table) in tables))
+ manifest = dict(
+ (app_name, filter(model_installed, model_list))
+ for app_name, model_list in manifest.iteritems()
+ )
+
# Create the tables for each model
for app_name, model_list in manifest.items():
for model in model_list:
# Create the model's database table, if it doesn't already
exist.
if verbosity >= 2:
print "Processing %s.%s model" % (app_name,
model._meta.object_name)
- opts = model._meta
- if
(connection.introspection.table_name_converter(opts.db_table) in tables or
- (opts.auto_created and
-
connection.introspection.table_name_converter(opts.auto_created._meta.db_table)
in tables)):
- continue
sql, references = connection.creation.sql_create_model(model,
self.style, seen_models)
seen_models.add(model)
created_models.add(model)
--
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?hl=en.