summaryrefslogtreecommitdiff
path: root/tests/modeltests
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2011-09-30 10:41:25 +0000
committerLuke Plant <L.Plant.98@cantab.net>2011-09-30 10:41:25 +0000
commit5009e45dfe366ebf520eecb49d72d5a11cee1623 (patch)
tree0c71b07ea7f799db8eafab3274dcb521e420547a /tests/modeltests
parent2eadc418aff64790eb5b8d06ac995c720c233e49 (diff)
Fixed #14270 - related manager classes should be cached
Thanks to Alex Gaynor for the report and initial patch, and mrmachine for more work on it. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests')
-rw-r--r--tests/modeltests/many_to_one/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/modeltests/many_to_one/tests.py b/tests/modeltests/many_to_one/tests.py
index 9f60c21f47..4f561b40ca 100644
--- a/tests/modeltests/many_to_one/tests.py
+++ b/tests/modeltests/many_to_one/tests.py
@@ -399,3 +399,13 @@ class ManyToOneTests(TestCase):
self.assertEqual(repr(a3),
repr(Article.objects.get(reporter_id=self.r2.id,
pub_date=datetime(2011, 5, 7))))
+
+ def test_manager_class_caching(self):
+ r1 = Reporter.objects.create(first_name='Mike')
+ r2 = Reporter.objects.create(first_name='John')
+
+ # Same twice
+ self.assertTrue(r1.article_set.__class__ is r1.article_set.__class__)
+
+ # Same as each other
+ self.assertTrue(r1.article_set.__class__ is r2.article_set.__class__)