diff options
| author | Justin Bronn <jbronn@gmail.com> | 2012-10-05 15:43:04 -0700 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2012-10-05 15:43:04 -0700 |
| commit | 065b52f18e7016b385feb8ad3de5dafb72ad202d (patch) | |
| tree | 90a719f031378e2f2a138470ef71a39f6245ce59 | |
| parent | 1c010ce41d6790b94d396aabe5c585cf1cc04b70 (diff) | |
Updated `GeoSQLCompiler.get_default_columns`.
| -rw-r--r-- | django/contrib/gis/db/models/sql/compiler.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/django/contrib/gis/db/models/sql/compiler.py b/django/contrib/gis/db/models/sql/compiler.py index 233ca5a03e..cf6a8ad047 100644 --- a/django/contrib/gis/db/models/sql/compiler.py +++ b/django/contrib/gis/db/models/sql/compiler.py @@ -119,10 +119,10 @@ 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() - # Skip all proxy to the root proxied model - proxied_model = opts.concrete_model if start_alias: seen = {None: start_alias} @@ -133,12 +133,9 @@ class GeoSQLCompiler(compiler.SQLCompiler): try: alias = seen[model] except KeyError: - if model is proxied_model: - alias = start_alias - else: - link_field = opts.get_ancestor_link(model) - alias = self.query.join((start_alias, model._meta.db_table, - 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 else: # If we're starting from the base model of the queryset, the |
