Ticket #2260: fix_tables_created_in_wrong_order.diff
File fix_tables_created_in_wrong_order.diff, 1.1 KB (added by , 18 years ago) |
---|
-
django/core/management.py
94 94 "Edit your settings file and change DATABASE_ENGINE to something like 'postgresql' or 'mysql'.\n")) 95 95 sys.exit(1) 96 96 97 app_models = models.get_models(app) 98 97 99 # Get installed models, so we generate REFERENCES right 100 # Remove all tables belonging to app from the list of known 101 # models, thus assuming they will be dropped before executing 102 # CREATE commands (most common case: the sqlreset command). 98 103 final_output = [] 99 known_models = set(_get_installed_models(_get_table_list())) 104 known_models = set([model for model in _get_installed_models(_get_table_list()) 105 if model not in app_models]) 100 106 pending_references = {} 101 107 102 app_models = models.get_models(app)103 104 108 for model in app_models: 105 109 output, references = _get_sql_model_create(model, known_models) 106 110 final_output.extend(output)