mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #21204 -- Tracked field deferrals by field instead of models.
This ensures field deferral works properly when a model is involved more than once in the same query with a distinct deferral mask.
This commit is contained in:
committed by
Mariusz Felisiak
parent
5d12650ed9
commit
b3db6c8dcb
@@ -290,6 +290,8 @@ class InvalidDeferTests(SimpleTestCase):
|
||||
msg = "Primary has no field named 'missing'"
|
||||
with self.assertRaisesMessage(FieldDoesNotExist, msg):
|
||||
list(Primary.objects.defer("missing"))
|
||||
with self.assertRaisesMessage(FieldError, "missing"):
|
||||
list(Primary.objects.defer("value__missing"))
|
||||
msg = "Secondary has no field named 'missing'"
|
||||
with self.assertRaisesMessage(FieldDoesNotExist, msg):
|
||||
list(Primary.objects.defer("related__missing"))
|
||||
@@ -298,6 +300,8 @@ class InvalidDeferTests(SimpleTestCase):
|
||||
msg = "Primary has no field named 'missing'"
|
||||
with self.assertRaisesMessage(FieldDoesNotExist, msg):
|
||||
list(Primary.objects.only("missing"))
|
||||
with self.assertRaisesMessage(FieldError, "missing"):
|
||||
list(Primary.objects.only("value__missing"))
|
||||
msg = "Secondary has no field named 'missing'"
|
||||
with self.assertRaisesMessage(FieldDoesNotExist, msg):
|
||||
list(Primary.objects.only("related__missing"))
|
||||
|
||||
Reference in New Issue
Block a user