mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #3615: Added support for loading fixtures with forward references on database backends (such as MySQL/InnoDB) that do not support deferred constraint checking. Many thanks to jsdalton for coming up with a clever solution to this long-standing issue, and to jacob, ramiro, graham_king, and russellm for review/testing. (Apologies if I missed anyone else who helped here.)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
# This is necessary in Python 2.5 to enable the with statement, in 2.6
|
||||
# and up it is no longer necessary.
|
||||
from __future__ import with_statement
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from datetime import datetime
|
||||
from StringIO import StringIO
|
||||
@@ -5,7 +9,7 @@ from xml.dom import minidom
|
||||
|
||||
from django.conf import settings
|
||||
from django.core import serializers
|
||||
from django.db import transaction
|
||||
from django.db import transaction, connection
|
||||
from django.test import TestCase, TransactionTestCase, Approximate
|
||||
from django.utils import simplejson, unittest
|
||||
|
||||
@@ -252,8 +256,9 @@ class SerializersTransactionTestBase(object):
|
||||
transaction.enter_transaction_management()
|
||||
transaction.managed(True)
|
||||
objs = serializers.deserialize(self.serializer_name, self.fwd_ref_str)
|
||||
for obj in objs:
|
||||
obj.save()
|
||||
with connection.constraint_checks_disabled():
|
||||
for obj in objs:
|
||||
obj.save()
|
||||
transaction.commit()
|
||||
transaction.leave_transaction_management()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user