def detach(self, ids=None, touch=True):
        """
        Detach models from the relationship.
        """
        if isinstance(ids, orator.orm.model.Model):
            ids = ids.get_key()

        if ids is None:
            ids = []

        query = self._new_pivot_query()

        if not isinstance(ids, list):
            ids = [ids]

        if len(ids) > 0:
            query.where_in(self._other_key, ids)

        if touch:
            self.touch_if_touching()

        results = query.delete()

        return results
def detach ( self , ids = None , touch = True ) : if isinstance ( ids , orator . orm . model . Model ) : ids = ids . get_key ( ) if ids is None : ids = [ ] query = self . _new_pivot_query ( ) if not isinstance ( ids , list ) : ids = [ ids ] if len ( ids ) > 0 : query . where_in ( self . _other_key , ids ) if touch : self . touch_if_touching ( ) results = query . delete ( ) return results
Detach models from the relationship.