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
This commit is contained in:
Adrian Holovaty 2006-01-30 02:09:25 +00:00
parent 502225ef86
commit 880c176381
1 changed files with 1 additions and 4 deletions

View File

@ -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 [])]