Ticket #13934: gis-local_only.patch

File gis-local_only.patch, 1.4 KB (added by sfllaw, 5 years ago)
  • django/contrib/gis/db/models/sql/compiler.py

    old new class GeoSQLCompiler(compiler.SQLCompile 
    9595        return result
    9696
    9797    def get_default_columns(self, with_aliases=False, col_aliases=None,
    98                             start_alias=None, opts=None, as_pairs=False):
     98                            start_alias=None, opts=None, as_pairs=False,
     99                            local_only=False):
    99100        """
    100101        Computes the default columns for selecting every field in the base
    101102        model. Will sometimes be called to pull in related models (e.g. via
    class GeoSQLCompiler(compiler.SQLCompile 
    113114        result = []
    114115        if opts is None:
    115116            opts = self.query.model._meta
     117        qn = self.quote_name_unless_alias
     118        qn2 = self.connection.ops.quote_name
    116119        aliases = set()
    117120        only_load = self.deferred_to_columns()
    118121        # Skip all proxy to the root proxied model
    class GeoSQLCompiler(compiler.SQLCompile 
    121124        if start_alias:
    122125            seen = {None: start_alias}
    123126        for field, model in opts.get_fields_with_model():
     127            if local_only and model is not None:
     128                continue
    124129            if start_alias:
    125130                try:
    126131                    alias = seen[model]
Back to Top