From a8598c7de2d600fa4c3b4e6d80c2fafb9063215b Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sat, 21 May 2011 16:54:25 +0000 Subject: Fixed #11789 -- Fixed aggregates so it interacts with QuerySet none() in a way consistent with other empty query sets. Thanks alexr for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16254 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/query.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'django') diff --git a/django/db/models/query.py b/django/db/models/query.py index 9c3aeaa8d3..6a6a82968f 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -1132,6 +1132,14 @@ class EmptyQuerySet(QuerySet): """ return 0 + def aggregate(self, *args, **kwargs): + """ + Return a dict mapping the aggregate names to None + """ + for arg in args: + kwargs[arg.default_alias] = arg + return dict([(key, None) for key in kwargs]) + # EmptyQuerySet is always an empty result in where-clauses (and similar # situations). value_annotation = False -- cgit v1.3