From d53837b8bb90fd85d5a250a386bacd6da456940d Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 30 Jan 2006 02:23:56 +0000 Subject: [PATCH] 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 --- django/db/models/query.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/django/db/models/query.py b/django/db/models/query.py index d9c5f4d6ff..e4857329cc 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -59,12 +59,14 @@ def quote_only_if_word(word): class QuerySet(object): "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(). core_filters = {} + # Subclasses need to provide 'self.klass' attribute for this class + # to be able to function. + klass = None + def __init__(self): self._filters = self.core_filters.copy() self._order_by = () # Ordering, e.g. ('date', '-name') @@ -162,6 +164,7 @@ class QuerySet(object): def _clone(self, **kwargs): c = QuerySet() + c.klass = self.klass c._filters = self._filters.copy() c._order_by = self._order_by c._select_related = self._select_related