diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-16 02:58:00 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-04-16 02:58:00 +0000 |
| commit | 1add6fb36638f064f817d91ff5fb5222555b410c (patch) | |
| tree | f662e1e53472bddcac7771d9c66a6db889dec77a /django/db/models/sql | |
| parent | c934beea01b62ae0daa3ee09f1bad3fac835b019 (diff) | |
queryset-refactor: Querysets no longer need to be customised per-backend.
Instead, it's the Query class that is backend-dependent. So make that explicit
in the code (code should refer to sql.Query and they will always get the right
backend-specific class).
This also fixes the main part of #6956, in that the various subclasses of Query
automatically use any custom Query class.
Fixed #6956.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7426 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/sql')
| -rw-r--r-- | django/db/models/sql/query.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 80ec236edb..d804075926 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -13,6 +13,7 @@ from copy import deepcopy from django.utils.tree import Node from django.utils.datastructures import SortedDict from django.dispatch import dispatcher +from django.db import connection from django.db.models import signals from django.db.models.sql.where import WhereNode, EverythingNode, AND, OR from django.db.models.sql.datastructures import Count @@ -1371,6 +1372,11 @@ class Query(object): return iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), self.connection.features.empty_fetchmany_value) +# Use the backend's custom Query class if it defines one. Otherwise, use the +# default. +if connection.features.uses_custom_query_class: + Query = connection.ops.query_class(Query) + def get_order_dir(field, default='ASC'): """ Returns the field name and direction for an order specification. For |
