diff --git a/tests/regressiontests/transactions_regress/models.py b/tests/regressiontests/transactions_regress/models.py
index 54e6f4f..e8bca8a 100644
|
a
|
b
|
from django.db import models
|
| 2 | 2 | |
| 3 | 3 | class Mod(models.Model): |
| 4 | 4 | fld = models.IntegerField() |
| | 5 | |
| | 6 | class M2mA(models.Model): |
| | 7 | others = models.ManyToManyField('M2mB') |
| | 8 | |
| | 9 | class M2mB(models.Model): |
| | 10 | fld = models.IntegerField() |
diff --git a/tests/regressiontests/transactions_regress/tests.py b/tests/regressiontests/transactions_regress/tests.py
index 26ef416..2195fae 100644
|
a
|
b
|
from django.db import connection, transaction
|
| 5 | 5 | from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError |
| 6 | 6 | from django.test import TransactionTestCase, skipUnlessDBFeature |
| 7 | 7 | |
| 8 | | from .models import Mod |
| | 8 | from .models import Mod, M2mA, M2mB |
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | class TestTransactionClosing(TransactionTestCase): |
| … |
… |
class TestTransactionClosing(TransactionTestCase):
|
| 164 | 164 | _ = User.objects.all()[0] |
| 165 | 165 | except: |
| 166 | 166 | self.fail("A transaction consisting of a failed operation was not closed.") |
| | 167 | |
| | 168 | class TestManyToManyAddTransaction(TransactionTestCase): |
| | 169 | def test_manyrelated_add_commit(self): |
| | 170 | """test for 16818""" |
| | 171 | a = M2mA.objects.create() |
| | 172 | b = M2mB.objects.create(fld=10) |
| | 173 | a.others.add(b) |
| | 174 | transaction.rollback() |
| | 175 | self.assertQuerysetEqual(a.others.all(),['<M2mB: M2mB object>']) |