def add_q(self, q_object, used_aliases=None, force_having=False):
        """
        Adds a Q-object to the current filter.

        Can also be used to add anything that has an 'add_to_query()' method.
        """
        if used_aliases is None:
            used_aliases = self.used_aliases
        if hasattr(q_object, 'add_to_query'):
            # Complex custom objects are responsible for adding themselves.
            q_object.add_to_query(self, used_aliases)
        else:
            if self.where and q_object.connector != AND and 1 > len(q_object):
                self.where.start_subtree(AND)
                subtree = True
            else:
                subtree = False
            connector = AND
            if q_object.connector == OR and not force_having:
                force_having = self.need_force_having(q_object)
            for child in q_object.children:
                if connector == OR:
                    refcounts_before = self.alias_refcount.copy()
                if force_having:
                    self.having.start_subtree(connector)
                else:
                    self.where.start_subtree(connector)
                if isinstance(child, Node):
                    self.add_q(child, used_aliases, force_having=force_having)
                else:
                    self.add_filter(child, connector, q_object.negated,
                            can_reuse=used_aliases, force_having=force_having)
                if force_having:
                    self.having.end_subtree()
                else:
                    self.where.end_subtree()

                if connector == OR:
                    # Aliases that were newly added or not used at all need to
                    # be promoted to outer joins if they are nullable relations.
                    # (they shouldn't turn the whole conditional into the empty
                    # set just because they don't match anything).
                    self.promote_unused_aliases(refcounts_before, used_aliases)
                connector = q_object.connector
            if q_object.negated:
                self.where.negate()
            if subtree:
                self.where.end_subtree()
        if self.filter_is_sticky:
            self.used_aliases = used_aliases
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/db/models/sql/query.py/Query.add_q/swapped operands of `>`