def disable_delete_on_object(self, obj, ignore_models=set()):
        """Return a veto message which explains why this object cannot be
        deleted.  Return `None` if there is no veto.

        If `ignore_model` (a set of model class objects) is specified,
        do not check for vetos on ForeignKey fields defined on one of
        these models.

        """
        #logger.info("20101104 called %s.disable_delete(%s)", obj, self)
        # print "20150831 disable_delete", obj, self
        for m, fk in self.fklist:
            if ignore_models in m:
                # print "20150831 skipping", m, fk
                continue
            # if m.__name__.endswith("Partner") and fk.name == 'partner':
            # print 20150831, m, fk
            if fk.name in m.allow_cascaded_delete:
                continue
            if fk.null and fk.rel.on_delete == models.SET_NULL:
                continue
            n = m.objects.filter(**{fk.name: obj}).count()
            if n:
                return obj.delete_veto_message(m, n)
        kernel = settings.SITE.kernel
        # print "20141208 generic related objects for %s:" % obj
        for gfk, fk_field, qs in kernel.get_generic_related(obj):
            if gfk.name in qs.model.allow_cascaded_delete:
                continue
            if fk_field.null:  # a nullable GFK is no reason to veto
                continue
            n = qs.count()
            # print "20141208 - %s %s %s" % (
            #     gfk.model, gfk.name, qs.query)
            if n:
                return obj.delete_veto_message(qs.model, n)
        return None
dataset/ETHPy150Open lsaffre/lino/lino/core/ddh.py/DisableDeleteHandler.disable_delete_on_object/swapped operands of `in`