mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #28549 -- Fixed QuerySet.defer() with super and subclass fields.
Previously, deferring fields in different classes didn't omit the superclass' deferred field. Thanks Simon Charette for the suggested fix.
This commit is contained in:
parent
e5bd585c6e
commit
84b7cb7df0
2 changed files with 6 additions and 1 deletions
|
@ -188,6 +188,11 @@ class BigChildDeferTests(AssertionMixin, TestCase):
|
|||
self.assertEqual(obj.value, "foo")
|
||||
self.assertEqual(obj.other, "bar")
|
||||
|
||||
def test_defer_subclass_both(self):
|
||||
# Deferring fields from both superclass and subclass works.
|
||||
obj = BigChild.objects.defer("other", "value").get(name="b1")
|
||||
self.assert_delayed(obj, 2)
|
||||
|
||||
def test_only_baseclass_when_subclass_has_added_field(self):
|
||||
# You can retrieve a single field on a baseclass
|
||||
obj = BigChild.objects.only("name").get(name="b1")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue