Skip to content

Commit

Permalink
Fixed #9717 -- Corrected a problem where django-admin.py flush would …
Browse files Browse the repository at this point in the history
…attempt to flush database tables that had not yet been created. This occurred when an application had been added to INSTALLED_APPS, but had not yet been synchronized. Thanks to Julien Phalip for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9535 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Nov 29, 2008
1 parent 8559fc6 commit 8e68fc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django/core/management/sql.py
Expand Up @@ -119,13 +119,13 @@ def sql_reset(app, style):
def sql_flush(style, only_django=False): def sql_flush(style, only_django=False):
""" """
Returns a list of the SQL statements used to flush the database. Returns a list of the SQL statements used to flush the database.
If only_django is True, then only table names that have associated Django If only_django is True, then only table names that have associated Django
models and are in INSTALLED_APPS will be included. models and are in INSTALLED_APPS will be included.
""" """
from django.db import connection from django.db import connection
if only_django: if only_django:
tables = connection.introspection.django_table_names() tables = connection.introspection.django_table_names(only_existing=True)
else: else:
tables = connection.introspection.table_names() tables = connection.introspection.table_names()
statements = connection.ops.sql_flush(style, tables, connection.introspection.sequence_list()) statements = connection.ops.sql_flush(style, tables, connection.introspection.sequence_list())
Expand Down

0 comments on commit 8e68fc6

Please sign in to comment.