From 880c17638152358d91f3ade97f51a87ce73d9ba5 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 30 Jan 2006 02:09:25 +0000 Subject: [PATCH] magic-removal: Changed QuerySet to copy core_filters in init() instead of for every query git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2160 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/query.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/django/db/models/query.py b/django/db/models/query.py index 2ac7b46049..9d0d6b4ac6 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -66,7 +66,7 @@ class QuerySet(object): core_filters = {} def __init__(self): - self._filters = {} # Dictionary of lookup parameters, e.g. {'foo__gt': 3} + self._filters = self.core_filters.copy() self._order_by = () # Ordering, e.g. ('date', '-name') self._select_related = False # Whether to fill cache for related objects. self._distinct = False # Whether the query should use SELECT DISTINCT. @@ -174,9 +174,6 @@ class QuerySet(object): def _get_sql_clause(self, allow_joins): opts = self.klass._meta - # Apply core filters. - self._filters.update(self.core_filters) - # Construct the fundamental parts of the query: SELECT X FROM Y WHERE Z. select = ["%s.%s" % (backend.quote_name(opts.db_table), backend.quote_name(f.column)) for f in opts.fields] tables = [quote_only_if_word(t) for t in (self._tables or [])]