2020-04-26 19:46:58 +02:00
|
|
|
from django.dispatch import receiver
|
|
|
|
from .models import Task
|
2024-02-27 20:44:35 +01:00
|
|
|
from config.signals import stream_inactive
|
|
|
|
from config.models import Stream
|
2020-04-26 19:46:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
@receiver(stream_inactive)
|
|
|
|
def delete_tasks(sender, **kwargs):
|
|
|
|
# when a stream was unpublished, all related tasks need to be deleted.
|
|
|
|
stream = Stream.objects.get(stream=kwargs['stream'])
|
|
|
|
Task.objects.filter(stream=stream).delete()
|