mirror of
https://github.com/django/django.git
synced 2025-06-29 15:29:13 +00:00
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:
parent
502225ef86
commit
880c176381
@ -66,7 +66,7 @@ class QuerySet(object):
|
|||||||
core_filters = {}
|
core_filters = {}
|
||||||
|
|
||||||
def __init__(self):
|
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._order_by = () # Ordering, e.g. ('date', '-name')
|
||||||
self._select_related = False # Whether to fill cache for related objects.
|
self._select_related = False # Whether to fill cache for related objects.
|
||||||
self._distinct = False # Whether the query should use SELECT DISTINCT.
|
self._distinct = False # Whether the query should use SELECT DISTINCT.
|
||||||
@ -174,9 +174,6 @@ class QuerySet(object):
|
|||||||
def _get_sql_clause(self, allow_joins):
|
def _get_sql_clause(self, allow_joins):
|
||||||
opts = self.klass._meta
|
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.
|
# 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]
|
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 [])]
|
tables = [quote_only_if_word(t) for t in (self._tables or [])]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user