Ticket #4528: db_pre_sync_r6799.patch
File db_pre_sync_r6799.patch, 2.4 KB (added by , 17 years ago) |
---|
-
django/db/models/signals.py
9 9 pre_delete = object() 10 10 post_delete = object() 11 11 12 pre_syncdb = object() 12 13 post_syncdb = object() -
django/core/management/commands/syncdb.py
21 21 def handle_noargs(self, **options): 22 22 from django.db import connection, transaction, models 23 23 from django.conf import settings 24 from django.core.management.sql import table_list, installed_models, sql_model_create, sql_for_pending_references, many_to_many_sql_for_model, custom_sql_for_model, sql_indexes_for_model, emit_post_sync_signal 24 from django.core.management.sql import table_list, installed_models, sql_model_create, sql_for_pending_references, many_to_many_sql_for_model, custom_sql_for_model, sql_indexes_for_model, emit_post_sync_signal, emit_pre_sync_signal 25 25 26 26 verbosity = int(options.get('verbosity', 1)) 27 27 interactive = options.get('interactive') … … 36 36 except ImportError: 37 37 pass 38 38 39 emit_pre_sync_signal(verbosity, interactive) 39 40 cursor = connection.cursor() 40 41 41 42 if connection.features.uses_case_insensitive_names: -
django/core/management/sql.py
473 473 ) 474 474 return output 475 475 476 def emit_pre_sync_signal(verbosity, interactive): 477 from django.db import models 478 from django.dispatch import dispatcher 479 # Emit the pre_sync signal for every application. 480 for app in models.get_apps(): 481 app_name = app.__name__.split('.')[-2] 482 if verbosity >= 2: 483 print "Running pre-sync handlers for application", app_name 484 dispatcher.send(signal=models.signals.pre_syncdb, sender=app, 485 app=app, verbosity=verbosity, interactive=interactive) 486 476 487 def emit_post_sync_signal(created_models, verbosity, interactive): 477 488 from django.db import models 478 489 from django.dispatch import dispatcher