Author: russellm Date: 2010-08-04 09:36:44 -0500 (Wed, 04 Aug 2010) New Revision: 13467
Modified: django/branches/releases/1.2.X/django/core/management/commands/flush.py Log: [1.2.X] Fixed #14025 -- Modified flush to adhere to router sync instructions when emmiting post-sync signals. Thanks to linovia for the patch. Backport of r13466 from trunk. Modified: django/branches/releases/1.2.X/django/core/management/commands/flush.py =================================================================== --- django/branches/releases/1.2.X/django/core/management/commands/flush.py 2010-08-04 14:34:48 UTC (rev 13466) +++ django/branches/releases/1.2.X/django/core/management/commands/flush.py 2010-08-04 14:36:44 UTC (rev 13467) @@ -1,7 +1,7 @@ from optparse import make_option from django.conf import settings -from django.db import connections, transaction, models, DEFAULT_DB_ALIAS +from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS from django.core.management import call_command from django.core.management.base import NoArgsCommand, CommandError from django.core.management.color import no_style @@ -66,7 +66,13 @@ # Emit the post sync signal. This allows individual # applications to respond as if the database had been # sync'd from scratch. - emit_post_sync_signal(models.get_models(), verbosity, interactive, db) + all_models = [ + (app.__name__.split('.')[-2], + [m for m in models.get_models(app, include_auto_created=True) + if router.allow_syncdb(db, m)]) + for app in models.get_apps() + ] + emit_post_sync_signal(all_models, verbosity, interactive, db) # Reinstall the initial_data fixture. kwargs = options.copy() -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.