1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Added virtual chassis member add view

This commit is contained in:
Jeremy Stretch
2018-02-01 11:39:13 -05:00
parent a4019be28c
commit f1da517c84
8 changed files with 168 additions and 39 deletions

14
netbox/dcim/signals.py Normal file
View File

@@ -0,0 +1,14 @@
from __future__ import unicode_literals
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from .models import Device, VirtualChassis
@receiver(pre_delete, sender=VirtualChassis)
def clear_virtualchassis_members(instance, **kwargs):
"""
When a VirtualChassis is deleted, nullify the vc_position and vc_priority fields of its prior members.
"""
Device.objects.filter(virtual_chassis=instance.pk).update(vc_position=None, vc_priority=None)