mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #30796 -- Prevented select_related() from mutating a queryset on chaining.
Thanks Darren Maki for the report.
This commit is contained in:
parent
e8ad265ac8
commit
37f8f29377
2 changed files with 12 additions and 0 deletions
|
@ -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': {}})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue