Commit ce3c71fa authored by Anssi Kääriäinen's avatar Anssi Kääriäinen
Browse files

Minor improvement to proxy model handling

Refs #19385
parent 807eff74
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -255,8 +255,6 @@ class SQLCompiler(object):
        result = []
        if opts is None:
            opts = self.query.model._meta
        # Skip all proxy to the root proxied model
        opts = opts.concrete_model._meta
        qn = self.quote_name_unless_alias
        qn2 = self.connection.ops.quote_name
        aliases = set()
+4 −4
Original line number Diff line number Diff line
@@ -997,8 +997,7 @@ class Query(object):
        whereas column determination is a later part, and side-effect, of
        as_sql()).
        """
        # Skip all proxy models
        opts = self.model._meta.concrete_model._meta
        opts = self.model._meta
        root_alias = self.tables[0]
        seen = {None: root_alias}

@@ -1013,7 +1012,8 @@ class Query(object):
        a parent of 'opts' or if it is None this method is a no-op.

        The 'alias' is the root alias for starting the join, 'seen' is a dict
        of model -> alias of existing joins.
        of model -> alias of existing joins. It must also contain a mapping
        of None -> some alias. This will be returned in the no-op case.
        """
        if model in seen:
            return seen[model]
@@ -1036,7 +1036,7 @@ class Query(object):
            connection = (alias, int_opts.db_table, link_field.column, int_opts.pk.column)
            alias = seen[int_model] = self.join(connection, nullable=False,
                                                join_field=link_field)
        return alias
        return alias or seen[None]

    def remove_inherited_models(self):
        """