Ticket #12471: support_timedelta_aggregate.patch
File support_timedelta_aggregate.patch, 762 bytes (added by , 15 years ago) |
---|
-
query.py
old new 22 22 from django.db.models.sql.where import WhereNode, Constraint, EverythingNode, AND, OR 23 23 from django.core.exceptions import FieldError 24 24 25 import datetime 26 25 27 __all__ = ['Query', 'RawQuery'] 26 28 27 29 class RawQuery(object): … … 294 296 elif aggregate.is_ordinal: 295 297 # Any ordinal aggregate (e.g., count) returns an int 296 298 return int(value) 299 elif isinstance(value, datetime.timedelta): 300 # Value is timedelta, return value as-is 301 return value 297 302 elif aggregate.is_computed: 298 303 # Any computed aggregate (e.g., avg) returns a float 299 304 return float(value)