1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed GIS regression in get_default_columns()

I changed the normal compiler's get_default_columns() but didn't change
the copy-pasted code in GIS compiler's get_default_columns().

Refs #19385
This commit is contained in:
Anssi Kääriäinen 2012-12-30 12:10:15 +02:00
parent ce3c71faf1
commit f80a1934cd

View File

@ -119,29 +119,16 @@ class GeoSQLCompiler(compiler.SQLCompiler):
result = []
if opts is None:
opts = self.query.model._meta
# Skip all proxy to the root proxied model
opts = opts.concrete_model._meta
aliases = set()
only_load = self.deferred_to_columns()
seen = self.query.included_inherited_models.copy()
if start_alias:
seen = {None: start_alias}
seen[None] = start_alias
for field, model in opts.get_fields_with_model():
if from_parent and model is not None and issubclass(from_parent, model):
# Avoid loading data for already loaded parents.
continue
if start_alias:
try:
alias = seen[model]
except KeyError:
link_field = opts.get_ancestor_link(model)
alias = self.query.join((start_alias, model._meta.db_table,
link_field.column, model._meta.pk.column))
seen[model] = alias
else:
# If we're starting from the base model of the queryset, the
# aliases will have already been set up in pre_sql_setup(), so
# we can save time here.
alias = self.query.included_inherited_models[model]
alias = self.query.join_parent_model(opts, model, start_alias, seen)
table = self.query.alias_map[alias].table_name
if table in only_load and field.column not in only_load[table]:
continue