right-tree/backend/right_tree/api/signals.py
Matthew Northcott 3f9f816a7e [#40] Bulk PDF export
- backend changes
2023-02-22 15:08:30 +13:00

12 lines
332 B
Python

from shutil import rmtree
from django.db.models.signals import post_delete
from django.dispatch import receiver
from .models import Export
from .resource_generation_utils import storage
@receiver(post_delete, sender=Export)
def delete_export(sender, instance, *args, **kwargs):
rmtree(storage.path(f"export_{instance.pk}"))