Exemplo n.º 1
0
def delete_enterprise_catalog_data(sender, instance, **kwargs):  # pylint: disable=unused-argument
    """
    Send deletions of Enterprise Catalogs to the Enterprise Catalog Service.
    """
    catalog_uuid = instance.uuid
    try:
        catalog_client = EnterpriseCatalogApiClient()
        catalog_client.delete_enterprise_catalog(catalog_uuid)
    except NotConnectedToOpenEdX as exc:
        logger.exception(
            'Unable to delete Enterprise Catalog {}'.format(str(catalog_uuid)),
            exc)
Exemplo n.º 2
0
    def delete_model(self, request, obj):
        """
        Deletes the corresponding catalog in the enterprise-catalog IDA

        From the warning in https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#modeladmin-methods, we don't
        prevent the deletion of the catalog if the response fails, but periodically check the logs to clean up any
        catalog that did not get deleted from the new service while we transition.
        """
        catalog_uuid = obj.uuid
        catalog_client = EnterpriseCatalogApiClient(user=request.user)
        catalog_client.delete_enterprise_catalog(catalog_uuid)

        super(EnterpriseCustomerCatalogAdmin, self).delete_model(request, obj)