mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #30796 -- Prevented select_related() from mutating a queryset on chaining.
Thanks Darren Maki for the report.
This commit is contained in:
committed by
Mariusz Felisiak
parent
e8ad265ac8
commit
37f8f29377
@@ -106,3 +106,10 @@ class TestQuery(SimpleTestCase):
|
||||
self.assertIsInstance(b_isnull, RelatedIsNull)
|
||||
self.assertIsInstance(b_isnull.lhs, SimpleCol)
|
||||
self.assertEqual(b_isnull.lhs.target, ObjectC._meta.get_field('objectb'))
|
||||
|
||||
def test_clone_select_related(self):
|
||||
query = Query(Item)
|
||||
query.add_select_related(['creator'])
|
||||
clone = query.clone()
|
||||
clone.add_select_related(['note', 'creator__extra'])
|
||||
self.assertEqual(query.select_related, {'creator': {}})
|
||||
|
||||
Reference in New Issue
Block a user