You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/terminal/signal_handlers.py

25 lines
573 B

# -*- coding: utf-8 -*-
#
from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Applet, AppletHost
@receiver(post_save, sender=AppletHost)
def on_applet_host_create(sender, instance, created=False, **kwargs):
if not created:
return
applets = Applet.objects.all()
instance.applets.set(applets)
@receiver(post_save, sender=Applet)
def on_applet_create(sender, instance, created=False, **kwargs):
if not created:
return
hosts = AppletHost.objects.all()
instance.hosts.set(hosts)