@@ -81,6 +81,10 @@ def read(self):
8181 if has_bz2 :
8282 compression_types ['bz2' ] = bz2 .BZ2File
8383
84+ # from https://code.djangoproject.com/attachment/ticket/3615/defer_constraint_checks.diff
85+ connection .begin_defer_constraint_checks ()
86+
87+
8488 app_module_paths = []
8589 for app in get_apps ():
8690 if hasattr (app , '__path__' ):
@@ -118,6 +122,9 @@ def read(self):
118122 self .stderr .write (
119123 self .style .ERROR ("Problem installing fixture '%s': %s is not a known serialization format.\n " %
120124 (fixture_name , format )))
125+ # from https://code.djangoproject.com/attachment/ticket/3615/defer_constraint_checks.diff
126+ connection .end_defer_constraint_checks ()
127+
121128 if commit :
122129 transaction .rollback (using = using )
123130 transaction .leave_transaction_management (using = using )
@@ -153,6 +160,9 @@ def read(self):
153160 fixture .close ()
154161 self .stderr .write (self .style .ERROR ("Multiple fixtures named '%s' in %s. Aborting.\n " %
155162 (fixture_name , humanize (fixture_dir ))))
163+ # from https://code.djangoproject.com/attachment/ticket/3615/defer_constraint_checks.diff
164+ connection .end_defer_constraint_checks ()
165+
156166 if commit :
157167 transaction .rollback (using = using )
158168 transaction .leave_transaction_management (using = using )
@@ -180,6 +190,10 @@ def read(self):
180190 except Exception :
181191 import traceback
182192 fixture .close ()
193+
194+ # from https://code.djangoproject.com/attachment/ticket/3615/defer_constraint_checks.diff
195+ connection .end_defer_constraint_checks ()
196+
183197 if commit :
184198 transaction .rollback (using = using )
185199 transaction .leave_transaction_management (using = using )
@@ -199,6 +213,9 @@ def read(self):
199213 self .stderr .write (
200214 self .style .ERROR ("No fixture data found for '%s'. (File format may be invalid.)\n " %
201215 (fixture_name )))
216+ # from https://code.djangoproject.com/attachment/ticket/3615/defer_constraint_checks.diff
217+ connection .end_defer_constraint_checks ()
218+
202219 if commit :
203220 transaction .rollback (using = using )
204221 transaction .leave_transaction_management (using = using )
@@ -219,6 +236,9 @@ def read(self):
219236 for line in sequence_sql :
220237 cursor .execute (line )
221238
239+ # from https://code.djangoproject.com/attachment/ticket/3615/defer_constraint_checks.diff
240+ connection .end_defer_constraint_checks ()
241+
222242 if commit :
223243 transaction .commit (using = using )
224244 transaction .leave_transaction_management (using = using )
0 commit comments