(cls, locations, ancestor_location_ids)
Bulk delete the given locations and update their ancestors

        WARNING databases may be left in an inconsistent state if the
        transaction in which this deletion is performed is rolled back.
        This method mutates other databases that will not be reverted on
        transaction rollback.

        :param locations: A list of SQLLocation objects. All locations
        in the list are expected to be leaf nodes or parents of nodes
        that are also in the list. Behavior of passing a non-leaf node
        without also passing all of its descendants is undefined.
        :param ancestor_location_ids: A list of ancestor `location_id`s
        for the given `locations`.
Bulk delete the given locations and update their ancestors
Bulk delete the given locations and update their ancestors
def bulk_delete(cls, locations, ancestor_location_ids):
        """Bulk delete the given locations and update their ancestors

        WARNING databases may be left in an inconsistent state if the
        transaction in which this deletion is performed is rolled back.
        This method mutates other databases that will not be reverted on
        transaction rollback.

        :param locations: A list of SQLLocation objects. All locations
        in the list are expected to be leaf nodes or parents of nodes
        that are also in the list. Behavior of passing a non-leaf node
        without also passing all of its descendants is undefined.
        :param ancestor_location_ids: A list of ancestor `location_id`s
        for the given `locations`.
        """
        from .tasks import update_users_at_locations
        from .document_store import publish_location_saved

        if not locations:
            return
        if len(set(loc.domain for loc in locations)) != 1:
            raise ValueError("cannot bulk delete locations for multiple domains")
        cls.objects.filter(id__in=[loc.id for loc in locations]).delete()
        # NOTE _remove_user() not called here. No domains were using
        # SQLLocation.user_id at the time this was written, and that
        # field is slated for removal.
        update_users_at_locations.delay(
            locations[0].domain,
            [loc.location_id for loc in locations],
            [loc.supply_point_id for loc in locations if loc.supply_point_id],
            ancestor_location_ids,
        )
        for loc in locations:
            publish_location_saved(loc.domain, loc.location_id, is_deletion=True)
def bulk_delete ( cls , locations , ancestor_location_ids ) : from . tasks import update_users_at_locations from . document_store import publish_location_saved if not locations : return if len ( set ( loc . domain for loc in locations ) ) != 1 : raise ValueError ( "cannot bulk delete locations for multiple domains" ) cls . objects . filter ( id__in = [ loc . id for loc in locations ] ) . delete ( ) # NOTE _remove_user() not called here. No domains were using # SQLLocation.user_id at the time this was written, and that # field is slated for removal. update_users_at_locations . delay ( locations [ 0 ] . domain , [ loc . location_id for loc in locations ] , [ loc . supply_point_id for loc in locations if loc . supply_point_id ] , ancestor_location_ids , ) for loc in locations : publish_location_saved ( loc . domain , loc . location_id , is_deletion = True )