mirror of
https://github.com/wahyd4/links.git
synced 2026-08-08 21:04:53 +10:00
18 lines
567 B
Python
18 lines
567 B
Python
from django.db.models.signals import post_save, post_delete
|
|
from django.dispatch import receiver
|
|
|
|
|
|
@receiver(post_save, sender='netscan.ScanProfile')
|
|
def reschedule_on_save(sender, instance, **kwargs):
|
|
from netscan.tasks import schedule_profile, unschedule_profile
|
|
if instance.enabled:
|
|
schedule_profile(instance)
|
|
else:
|
|
unschedule_profile(instance)
|
|
|
|
|
|
@receiver(post_delete, sender='netscan.ScanProfile')
|
|
def unschedule_on_delete(sender, instance, **kwargs):
|
|
from netscan.tasks import unschedule_profile
|
|
unschedule_profile(instance)
|