From e1575c09d47db0b5b2b26f28cd6df82530519e98 Mon Sep 17 00:00:00 2001 From: Hugo Levy-Falk Date: Sun, 29 Sep 2019 17:57:10 +0200 Subject: [PATCH] Fix mass_delete of machine so that AccessPoint deletion is possible. --- machines/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/machines/models.py b/machines/models.py index 68c7c58b..fdc7821e 100644 --- a/machines/models.py +++ b/machines/models.py @@ -258,11 +258,13 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model): @classmethod def mass_delete(cls, machine_queryset): """Mass delete for machine queryset""" + from topologie.models import AccessPoint Domain.objects.filter(cname__interface_parent__machine__in=machine_queryset)._raw_delete(machine_queryset.db) Domain.objects.filter(interface_parent__machine__in=machine_queryset)._raw_delete(machine_queryset.db) Ipv6List.objects.filter(interface__machine__in=machine_queryset)._raw_delete(machine_queryset.db) Interface.objects.filter(machine__in=machine_queryset).filter(port_lists__isnull=False).delete() Interface.objects.filter(machine__in=machine_queryset)._raw_delete(machine_queryset.db) + AccessPoint.objects.filter(machine_ptr__in=machine_queryset)._raw_delete(machine_queryset.db) machine_queryset._raw_delete(machine_queryset.db) @cached_property