Added check to prevent sequence reset if no fixtures are loaded.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5234 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2007-05-14 14:24:30 +00:00
parent 9350945963
commit 41fbd35613
1 changed files with 7 additions and 6 deletions

View File

@ -1405,12 +1405,13 @@ def load_data(fixture_labels, verbosity=1):
print "No %s fixture '%s' in %s." % \
(format, fixture_name, humanize(fixture_dir))
sequence_sql = backend.get_sql_sequence_reset(style, models)
if sequence_sql:
if verbosity > 1:
print "Resetting sequences"
for line in sequence_sql:
cursor.execute(line)
if count[0] > 0:
sequence_sql = backend.get_sql_sequence_reset(style, models)
if sequence_sql:
if verbosity > 1:
print "Resetting sequences"
for line in sequence_sql:
cursor.execute(line)
transaction.commit()
transaction.leave_transaction_management()