magic-removal: Changed QuerySet._clone() to copy self.klass

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2163 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-01-30 02:23:56 +00:00
parent 50e17688b0
commit d53837b8bb
1 changed files with 5 additions and 2 deletions

View File

@ -59,12 +59,14 @@ def quote_only_if_word(word):
class QuerySet(object): class QuerySet(object):
"Represents a lazy database lookup for a set of objects" "Represents a lazy database lookup for a set of objects"
# Subclasses need to provide 'self.klass' attribute for this class
# to be able to function.
# Dictionary of lookup parameters to apply to every _get_sql_clause(). # Dictionary of lookup parameters to apply to every _get_sql_clause().
core_filters = {} core_filters = {}
# Subclasses need to provide 'self.klass' attribute for this class
# to be able to function.
klass = None
def __init__(self): def __init__(self):
self._filters = self.core_filters.copy() self._filters = self.core_filters.copy()
self._order_by = () # Ordering, e.g. ('date', '-name') self._order_by = () # Ordering, e.g. ('date', '-name')
@ -162,6 +164,7 @@ class QuerySet(object):
def _clone(self, **kwargs): def _clone(self, **kwargs):
c = QuerySet() c = QuerySet()
c.klass = self.klass
c._filters = self._filters.copy() c._filters = self._filters.copy()
c._order_by = self._order_by c._order_by = self._order_by
c._select_related = self._select_related c._select_related = self._select_related