Skip to content

Commit

Permalink
Added check to prevent sequence reset if no fixtures are loaded.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5234 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed May 14, 2007
1 parent 9350945 commit 41fbd35
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions django/core/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 41fbd35

Please sign in to comment.