1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Fixed #32980 -- Made models cache related managers.

This commit is contained in:
Keryn Knight
2021-08-01 12:13:35 +01:00
committed by Mariusz Felisiak
parent ba9ced3e9a
commit 4f8c7fd9d9
10 changed files with 173 additions and 13 deletions

View File

@@ -31,6 +31,14 @@ class M2MRegressionTests(TestCase):
self.assertSequenceEqual(e1.topics.all(), [t1])
self.assertSequenceEqual(e1.related.all(), [t2])
def test_m2m_managers_reused(self):
s1 = SelfRefer.objects.create(name='s1')
e1 = Entry.objects.create(name='e1')
self.assertIs(s1.references, s1.references)
self.assertIs(s1.related, s1.related)
self.assertIs(e1.topics, e1.topics)
self.assertIs(e1.related, e1.related)
def test_internal_related_name_not_in_error_msg(self):
# The secret internal related names for self-referential many-to-many
# fields shouldn't appear in the list when an error is made.