diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/query.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index bce48e17ef..b39a988ab0 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -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: |
