Skip to content

Commit

Permalink
[1.2.X] Fixed #14025 -- Modified flush to adhere to router sync instr…
Browse files Browse the repository at this point in the history
…uctions when emmiting post-sync signals. Thanks to linovia for the patch.

Backport of r13466 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13467 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Aug 4, 2010
1 parent 972a9c7 commit 389c72c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions 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
Expand Down Expand Up @@ -66,7 +66,13 @@ def handle_noargs(self, **options):
# 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()
Expand Down

0 comments on commit 389c72c

Please sign in to comment.