class Any(BuiltinLookup):
    lookup_name = 'any'

def get_rhs_op(self, connection, rhs):
    return ' = ANY(%s)' % (rhs,)
Field.register_lookup(Any)
How to avoid brackets in SQL around Django custom database function call?