Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 41fbd35613a12d068d0d62ecc6b96ddb07609b2b 1 parent 9350945
Russell Keith-Magee authored

Showing 1 changed file with 7 additions and 6 deletions. Show diff stats Hide diff stats

  1. 13  django/core/management.py
13  django/core/management.py
@@ -1405,12 +1405,13 @@ def load_data(fixture_labels, verbosity=1):
1405 1405
                         print "No %s fixture '%s' in %s." % \
1406 1406
                             (format, fixture_name, humanize(fixture_dir))
1407 1407
                             
1408  
-    sequence_sql = backend.get_sql_sequence_reset(style, models)
1409  
-    if sequence_sql:
1410  
-        if verbosity > 1:
1411  
-            print "Resetting sequences"
1412  
-        for line in sequence_sql:
1413  
-            cursor.execute(line)
  1408
+    if count[0] > 0:
  1409
+        sequence_sql = backend.get_sql_sequence_reset(style, models)
  1410
+        if sequence_sql:
  1411
+            if verbosity > 1:
  1412
+                print "Resetting sequences"
  1413
+            for line in sequence_sql:
  1414
+                cursor.execute(line)
1414 1415
             
1415 1416
     transaction.commit()
1416 1417
     transaction.leave_transaction_management()

0 notes on commit 41fbd35

Please sign in to comment.
Something went wrong with that request. Please try again.