def as_sql(self, qn, connection):
        """
        Create the proper SQL fragment. This inserts something like
        "(T0.flags & value) != 0".

        This will be called by Where.as_sql()
        """
        engine = connection.settings_dict['ENGINE'].rsplit('.', -1)[-1]
        if engine.startswith('postgres'):
            XOR_OPERATOR = '#'
        elif engine.startswith('sqlite'):
            raise NotImplementedError
        else:
            XOR_OPERATOR = '^'

        if self.bit:
            return ("%s.%s | %d" % (qn(self.table_alias), qn(self.column), self.bit.mask),
                    [])
        return ((qn(self.table_alias), qn(self.column), XOR_OPERATOR, self.bit.mask) % "%s.%s %s %d",
                [])
dataset/ETHPy150Open disqus/django-bitfield/bitfield/query.py/BitQuerySaveWrapper.as_sql/swapped operands of `%`