1
0
mirror of https://github.com/django/django.git synced 2025-10-28 08:06:09 +00:00

Fixed #35690 -- Errored nicely when using in_bulk() with a values() or values_list() queryset.

This commit is contained in:
John Parton
2024-08-18 21:52:58 -05:00
committed by Sarah Boyce
parent fd1dd76778
commit e4a2e22ddb
2 changed files with 9 additions and 0 deletions

View File

@@ -1101,6 +1101,8 @@ class QuerySet(AltersData):
"""
if self.query.is_sliced:
raise TypeError("Cannot use 'limit' or 'offset' with in_bulk().")
if not issubclass(self._iterable_class, ModelIterable):
raise TypeError("in_bulk() cannot be used with values() or values_list().")
opts = self.model._meta
unique_fields = [
constraint.fields[0]