12 lines
383 B
Python
12 lines
383 B
Python
from django.dispatch import receiver
|
|
from .models import Task
|
|
from config.signals import stream_inactive
|
|
from config.models import Stream
|
|
|
|
|
|
@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()
|