mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
Fixed #31918 -- Allowed QuerySet.in_bulk() to fetch on a single distinct field.
This commit is contained in:
committed by
Mariusz Felisiak
parent
547a07fa7e
commit
b9be11d442
@@ -699,7 +699,8 @@ class QuerySet:
|
||||
if (
|
||||
field_name != 'pk' and
|
||||
not opts.get_field(field_name).unique and
|
||||
field_name not in unique_fields
|
||||
field_name not in unique_fields and
|
||||
not self.query.distinct_fields == (field_name,)
|
||||
):
|
||||
raise ValueError("in_bulk()'s field_name must be a unique field but %r isn't." % field_name)
|
||||
if id_list is not None:
|
||||
|
||||
Reference in New Issue
Block a user