summaryrefslogtreecommitdiff
path: root/tests/regressiontests/multiple_database/tests.py
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2012-09-05 09:39:03 -0400
committerAndrew Godwin <andrew@aeracode.org>2012-09-05 09:39:03 -0400
commitb546e7eb633022ee1962570387f22fb2bcea46ed (patch)
treef87f4a2d68fb66afae39148fa35489930710b623 /tests/regressiontests/multiple_database/tests.py
parentcd583d6dbd222ae61331a6965b0e1fc86c974c50 (diff)
parentcff911f4ba3b3e6393c58da5131ce8b188a68f0c (diff)
Merge branch 'master' into schema-alteration
Diffstat (limited to 'tests/regressiontests/multiple_database/tests.py')
-rw-r--r--tests/regressiontests/multiple_database/tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/multiple_database/tests.py b/tests/regressiontests/multiple_database/tests.py
index 74a5f2f550..782fe2bfc6 100644
--- a/tests/regressiontests/multiple_database/tests.py
+++ b/tests/regressiontests/multiple_database/tests.py
@@ -1546,6 +1546,21 @@ class RouterTestCase(TestCase):
# If you evaluate the query, it should work, running on 'other'
self.assertEqual(list(qs.values_list('title', flat=True)), ['Dive into Python'])
+ def test_deferred_models(self):
+ mark_def = Person.objects.using('default').create(name="Mark Pilgrim")
+ mark_other = Person.objects.using('other').create(name="Mark Pilgrim")
+ orig_b = Book.objects.using('other').create(title="Dive into Python",
+ published=datetime.date(2009, 5, 4),
+ editor=mark_other)
+ b = Book.objects.using('other').only('title').get(pk=orig_b.pk)
+ self.assertEqual(b.published, datetime.date(2009, 5, 4))
+ b = Book.objects.using('other').only('title').get(pk=orig_b.pk)
+ b.editor = mark_def
+ b.save(using='default')
+ self.assertEqual(Book.objects.using('default').get(pk=b.pk).published,
+ datetime.date(2009, 5, 4))
+
+
class AuthTestCase(TestCase):
multi_db = True