diff --git a/django/db/models/query.py b/django/db/models/query.py
index 6a6a829..8e37f71 100644
a
|
b
|
class EmptyQuerySet(QuerySet):
|
1126 | 1126 | """ |
1127 | 1127 | return self |
1128 | 1128 | |
| 1129 | def values(self, *fields): |
| 1130 | """ |
| 1131 | Always returns EmptyQuerySet. |
| 1132 | """ |
| 1133 | return self |
| 1134 | |
| 1135 | def values_list(self, *fields, **kwargs): |
| 1136 | """ |
| 1137 | Always returns EmptyQuerySet. |
| 1138 | """ |
| 1139 | return self |
| 1140 | |
1129 | 1141 | def update(self, **kwargs): |
1130 | 1142 | """ |
1131 | 1143 | Don't update anything. |
diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py
index 31856ba..31351f5 100644
a
|
b
|
class EmptyQuerySetTests(TestCase):
|
1471 | 1471 | Number.objects.none().values('num').order_by('num'), [] |
1472 | 1472 | ) |
1473 | 1473 | |
| 1474 | def test_bare_emptyqueryset_values(self): |
| 1475 | # #15959 -- .values()/.values_list() fails on EmptyQuerySet |
| 1476 | self.assertQuerysetEqual( |
| 1477 | EmptyQuerySet().values('id'), [] |
| 1478 | ) |
| 1479 | self.assertQuerysetEqual( |
| 1480 | EmptyQuerySet().values_list('id', flat=False), [] |
| 1481 | ) |
| 1482 | |
1474 | 1483 | def test_values_subquery(self): |
1475 | 1484 | self.assertQuerysetEqual( |
1476 | 1485 | Number.objects.filter(pk__in=Number.objects.none().values("pk")), |