Updated `GeoSQLCompiler.get_default_columns`.
This commit is contained in:
parent
1c010ce41d
commit
065b52f18e
|
@ -119,10 +119,10 @@ class GeoSQLCompiler(compiler.SQLCompiler):
|
||||||
result = []
|
result = []
|
||||||
if opts is None:
|
if opts is None:
|
||||||
opts = self.query.model._meta
|
opts = self.query.model._meta
|
||||||
|
# Skip all proxy to the root proxied model
|
||||||
|
opts = opts.concrete_model._meta
|
||||||
aliases = set()
|
aliases = set()
|
||||||
only_load = self.deferred_to_columns()
|
only_load = self.deferred_to_columns()
|
||||||
# Skip all proxy to the root proxied model
|
|
||||||
proxied_model = opts.concrete_model
|
|
||||||
|
|
||||||
if start_alias:
|
if start_alias:
|
||||||
seen = {None: start_alias}
|
seen = {None: start_alias}
|
||||||
|
@ -133,12 +133,9 @@ class GeoSQLCompiler(compiler.SQLCompiler):
|
||||||
try:
|
try:
|
||||||
alias = seen[model]
|
alias = seen[model]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if model is proxied_model:
|
link_field = opts.get_ancestor_link(model)
|
||||||
alias = start_alias
|
alias = self.query.join((start_alias, model._meta.db_table,
|
||||||
else:
|
link_field.column, model._meta.pk.column))
|
||||||
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
|
seen[model] = alias
|
||||||
else:
|
else:
|
||||||
# If we're starting from the base model of the queryset, the
|
# If we're starting from the base model of the queryset, the
|
||||||
|
|
Loading…
Reference in New Issue