diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 2800361..194fc9d 100644
|
a
|
b
|
from django.db.models.constants import LOOKUP_SEP
|
| 17 | 17 | from django.db.models.aggregates import refs_aggregate |
| 18 | 18 | from django.db.models.expressions import ExpressionNode |
| 19 | 19 | from django.db.models.fields import FieldDoesNotExist |
| | 20 | from django.db.models.fields.related import ManyToManyRel |
| 20 | 21 | from django.db.models.query_utils import Q |
| 21 | 22 | from django.db.models.related import PathInfo |
| 22 | 23 | from django.db.models.sql import aggregates as base_aggregates_module |
| … |
… |
class Query(object):
|
| 1606 | 1607 | targets, final_alias, joins = self.trim_joins(targets, joins, path) |
| 1607 | 1608 | for target in targets: |
| 1608 | 1609 | self.select.append(SelectInfo((final_alias, target.column), target)) |
| | 1610 | if isinstance(field.rel, ManyToManyRel) and 'id' not in field_names: |
| | 1611 | field_names.append('id') |
| 1609 | 1612 | except MultiJoin: |
| 1610 | 1613 | raise FieldError("Invalid field name: '%s'" % name) |
| 1611 | 1614 | except FieldError: |