def delete(request, document_id): # Check if manifest exists parts = document_id.split(":") if len(parts) != 2: return HttpResponse("Invalid document ID. Format: [data source]:[ID]", status=404) source = parts[0] id = parts[1] has_manifest = models.manifest_exists(id, source) if has_manifest: models.delete_manifest(id, source) return HttpResponse("Document ID %s has been deleted" % document_id) else: return HttpResponse("Document ID %s does not exist in the database" % document_id, status=404)
def delete(request, document_type, document_id): # Check if manifest exists source = document_type id = document_id has_manifest = models.manifest_exists(id, source) if has_manifest: models.delete_manifest(id, source) return HttpResponse("Document ID %s has been deleted" % document_id) else: return HttpResponse("Document ID %s does not exist in the database" % document_id, status=404)