Ticket #12286: 16329-apply-this-to-reproduce-proxy-model-inheritance-failure.diff
File 16329-apply-this-to-reproduce-proxy-model-inheritance-failure.diff, 2.2 KB (added by , 13 years ago) |
---|
-
django/core/management/commands/syncdb.py
7 7 from django.core.management.color import no_style 8 8 from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal 9 9 from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS 10 from django.utils.datastructures import SortedDict11 10 from django.utils.importlib import import_module 12 11 13 12 … … 63 62 pending_references = {} 64 63 65 64 # Build the manifest of apps and models that are to be synchronized 66 all_models = [65 manifest = dict( 67 66 (app.__name__.split('.')[-2], 68 67 [m for m in models.get_models(app, include_auto_created=True) 69 68 if router.allow_syncdb(db, m)]) 70 69 for app in models.get_apps() 71 ]72 def model_installed(model):73 opts = model._meta74 converter = connection.introspection.table_name_converter75 return not ((converter(opts.db_table) in tables) or76 (opts.auto_created and converter(opts.auto_created._meta.db_table) in tables))77 78 manifest = SortedDict(79 (app_name, filter(model_installed, model_list))80 for app_name, model_list in all_models81 70 ) 82 71 83 72 # Create the tables for each model … … 88 77 # Create the model's database table, if it doesn't already exist. 89 78 if verbosity >= 3: 90 79 print "Processing %s.%s model" % (app_name, model._meta.object_name) 80 opts = model._meta 81 if (connection.introspection.table_name_converter(opts.db_table) in tables or 82 (opts.auto_created and 83 connection.introspection.table_name_converter(opts.auto_created._meta.db_table) in tables)): 84 continue 91 85 sql, references = connection.creation.sql_create_model(model, self.style, seen_models) 92 86 seen_models.add(model) 93 87 created_models.add(model)