(self, *args, **kwargs)
Delete this location and all descentants

        Supply point cases and user updates are performed asynchronously.
Delete this location and all descentants
Delete this location and all descentants
def delete(self, *args, **kwargs):
        """Delete this location and all descentants

        Supply point cases and user updates are performed asynchronously.
        """
        from .tasks import update_users_at_locations
        from .document_store import publish_location_saved

        to_delete = self.get_descendants(include_self=True)
        for loc in to_delete:
            loc._remove_user()

        super(SQLLocation, self).delete(*args, **kwargs)
        update_users_at_locations.delay(
            self.domain,
            [loc.location_id for loc in to_delete],
            [loc.supply_point_id for loc in to_delete if loc.supply_point_id],
            list(self.get_ancestors().location_ids()),
        )
        for loc in to_delete:
            publish_location_saved(loc.domain, loc.location_id, is_deletion=True)
def delete ( self , * args , * * kwargs ) : from . tasks import update_users_at_locations from . document_store import publish_location_saved to_delete = self . get_descendants ( include_self = True ) for loc in to_delete : loc . _remove_user ( ) super ( SQLLocation , self ) . delete ( * args , * * kwargs ) update_users_at_locations . delay ( self . domain , [ loc . location_id for loc in to_delete ] , [ loc . supply_point_id for loc in to_delete if loc . supply_point_id ] , list ( self . get_ancestors ( ) . location_ids ( ) ) , ) for loc in to_delete : publish_location_saved ( loc . domain , loc . location_id , is_deletion = True )