diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 6b6c6b6..84b9301 100644
a
|
b
|
from django.db.backends.signals import connection_created
|
18 | 18 | from django.db.backends.sqlite3.client import DatabaseClient |
19 | 19 | from django.db.backends.sqlite3.creation import DatabaseCreation |
20 | 20 | from django.db.backends.sqlite3.introspection import DatabaseIntrospection |
| 21 | from django.db.models import fields |
| 22 | from django.db.models.sql import aggregates |
21 | 23 | from django.utils.dateparse import parse_date, parse_datetime, parse_time |
22 | 24 | from django.utils.functional import cached_property |
23 | 25 | from django.utils.safestring import SafeBytes |
… |
… |
class DatabaseOperations(BaseDatabaseOperations):
|
127 | 129 | limit = 999 if len(fields) > 1 else 500 |
128 | 130 | return (limit // len(fields)) if len(fields) > 0 else len(objs) |
129 | 131 | |
| 132 | def check_aggregate_support(self, aggregate): |
| 133 | # fix for ticket 19360 |
| 134 | bad_fields = (fields.DateField, fields.DateTimeField, fields.TimeField) |
| 135 | bad_aggregates = (aggregates.Sum, aggregates.Avg, |
| 136 | aggregates.Variance, aggregates.StdDev) |
| 137 | if isinstance(aggregate.source, bad_fields) and \ |
| 138 | isinstance(aggregate, bad_aggregates): |
| 139 | raise NotImplementedError( |
| 140 | 'You cannot use Sum, Avg, StdDev and Variance aggregations ' |
| 141 | 'on date/time fields in sqlite3 ' |
| 142 | 'since date/time is saved as text.') |
| 143 | |
130 | 144 | def date_extract_sql(self, lookup_type, field_name): |
131 | 145 | # sqlite doesn't support extract, so we fake it with the user-defined |
132 | 146 | # function django_extract that's registered in connect(). Note that |
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 9c2e140..505e5ba 100644
a
|
b
|
class Query(object):
|
119 | 119 | self.filter_is_sticky = False |
120 | 120 | self.included_inherited_models = {} |
121 | 121 | |
122 | | # SQL-related attributes |
| 122 | # SQL-related attributes |
123 | 123 | # Select and related select clauses as SelectInfo instances. |
124 | 124 | # The select is used for cases where we want to set up the select |
125 | 125 | # clause to contain other than default fields (values(), annotate(), |