diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-04 14:34:48 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-08-04 14:34:48 +0000 |
| commit | 81ac1735236d30d71cf0a8d73756e8df9ad8616e (patch) | |
| tree | bd6600d79596a3693d75981e2069906a5171e3a6 | |
| parent | e64cdf7129c5ff9a0229d6c3fcde00079a70a4f9 (diff) | |
Fixed #14025 -- Modified flush to adhere to router sync instructions when emmiting post-sync signals. Thanks to linovia for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13466 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/management/commands/flush.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py index 6836fe35ca..98e3f3151b 100644 --- a/django/core/management/commands/flush.py +++ b/django/core/management/commands/flush.py @@ -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 @@ The full error: %s""" % (connection.settings_dict['NAME'], e)) # 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() |
