1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #9619 -- Added a test that Field.from_db_value() is called on QuerySet.values()

This commit is contained in:
JensDiemer 2015-06-17 15:42:23 +02:00 committed by Tim Graham
parent ebd183a18c
commit 9aac99e96d
2 changed files with 6 additions and 1 deletions

View File

@ -325,6 +325,7 @@ answer newbie questions, and generally made Django that much better:
Jeff Hui <jeffkhui@gmail.com>
Jeffrey Gelens <jeffrey@gelens.org>
Jeff Triplett <jeff.triplett@gmail.com>
Jens Diemer <django@htfx.de>
Jens Page
Jeong-Min Lee <falsetru@gmail.com>
Jérémie Blaser <blaserje@gmail.com>

View File

@ -13,10 +13,14 @@ class FromDBValueTest(TestCase):
instance = CashModel.objects.get()
self.assertIsInstance(instance.cash, Cash)
def test_values(self):
def test_values_list(self):
values_list = CashModel.objects.values_list('cash', flat=True)
self.assertIsInstance(values_list[0], Cash)
def test_values(self):
values = CashModel.objects.values('cash')
self.assertIsInstance(values_list[0]['cash'], Cash)
def test_aggregation(self):
maximum = CashModel.objects.aggregate(m=Max('cash'))['m']
self.assertIsInstance(maximum, Cash)