mirror of https://github.com/jumpserver/jumpserver
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.
25 lines
573 B
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)
|