Django

Code

Changeset 7426

Show
Ignore:
Timestamp:
04/15/08 21:58:00 (3 months ago)
Author:
mtredinnick
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/queryset-refactor/django/db/models/query.py

    r7425 r7426  
    1717EmptyResultSet = sql.EmptyResultSet 
    1818 
    19 class _QuerySet(object): 
     19class QuerySet(object): 
    2020    "Represents a lazy database lookup for a set of objects" 
    2121    def __init__(self, model=None, query=None): 
     
    479479                    % (self.__class__.__name__, other.__class__.__name__)) 
    480480 
    481 # Use the backend's QuerySet class if it defines one. Otherwise, use _QuerySet. 
    482 if connection.features.uses_custom_queryset: 
    483     QuerySet = connection.ops.query_set_class(_QuerySet) 
    484 else: 
    485     QuerySet = _QuerySet 
    486  
    487481class ValuesQuerySet(QuerySet): 
    488482    def __init__(self, *args, **kwargs): 
  • django/branches/queryset-refactor/django/db/models/sql/query.py

    r7418 r7426  
    1414from django.utils.datastructures import SortedDict 
    1515from django.dispatch import dispatcher 
     16from django.db import connection 
    1617from django.db.models import signals 
    1718from django.db.models.sql.where import WhereNode, EverythingNode, AND, OR 
     
    13721373                self.connection.features.empty_fetchmany_value) 
    13731374 
     1375# Use the backend's custom Query class if it defines one. Otherwise, use the 
     1376# default. 
     1377if connection.features.uses_custom_query_class: 
     1378    Query = connection.ops.query_class(Query) 
     1379 
    13741380def get_order_dir(field, default='ASC'): 
    13751381    """