diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 0583386..2ce9e29 100644
a
|
b
|
class BaseQuery(object):
|
196 | 196 | obj.distinct = self.distinct |
197 | 197 | obj.select_related = self.select_related |
198 | 198 | obj.related_select_cols = [] |
199 | | obj.aggregates = self.aggregates.copy() |
| 199 | obj.aggregates = deepcopy(self.aggregates) |
200 | 200 | if self.aggregate_select_mask is None: |
201 | 201 | obj.aggregate_select_mask = None |
202 | 202 | else: |
… |
… |
def add_to_dict(data, key, value):
|
2368 | 2368 | data[key].add(value) |
2369 | 2369 | else: |
2370 | 2370 | data[key] = set([value]) |
2371 | | |
diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py
index 275ea07..2dfa181 100644
a
|
b
|
FieldError: Cannot resolve keyword 'foo' into field. Choices are: authors, conta
|
259 | 259 | >>> Book.objects.annotate(Count('publisher')).values('publisher').count() |
260 | 260 | 6 |
261 | 261 | |
| 262 | >>> publishers = Publisher.objects.filter(id__in=(1,2)) |
| 263 | >>> publishers |
| 264 | [<Publisher: Apress>, <Publisher: Sams>] |
| 265 | |
| 266 | >>> publishers = publishers.annotate(n_books=models.Count('book')) |
| 267 | >>> publishers[0].n_books |
| 268 | 2 |
| 269 | |
| 270 | >>> publishers |
| 271 | [<Publisher: Apress>, <Publisher: Sams>] |
| 272 | |
| 273 | >>> books = Book.objects.filter(publisher__in=publishers) |
| 274 | >>> books |
| 275 | [<Book: Practical Django Projects>, <Book: Sams Teach Yourself Django in 24 Hours>, <Book: The Definitive Guide to Django: Web Development Done Right>] |
| 276 | |
| 277 | >>> publishers |
| 278 | [<Publisher: Apress>, <Publisher: Sams>] |
262 | 279 | """ |
263 | 280 | } |
264 | 281 | |
… |
… |
if settings.DATABASE_ENGINE != 'sqlite3':
|
307 | 324 | |
308 | 325 | |
309 | 326 | """ |
310 | | |