mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 16:06:43 -06:00
Restore original termination count logic
This commit is contained in:
parent
2241559b64
commit
13313420f2
@ -122,15 +122,17 @@ class BulkDisconnectView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View)
|
|||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
cable_ids = {
|
count = 0
|
||||||
obj.cable.pk for obj in self.queryset.filter(pk__in=form.cleaned_data['pk'])
|
cable_ids = set()
|
||||||
if obj.cable is not None
|
for obj in self.queryset.filter(pk__in=form.cleaned_data['pk']):
|
||||||
}
|
if obj.cable:
|
||||||
|
cable_ids.add(obj.cable.pk)
|
||||||
|
count += 1
|
||||||
for cable in Cable.objects.filter(pk__in=cable_ids):
|
for cable in Cable.objects.filter(pk__in=cable_ids):
|
||||||
cable.delete()
|
cable.delete()
|
||||||
|
|
||||||
messages.success(request, _("Disconnected {count} {type}").format(
|
messages.success(request, _("Disconnected {count} {type}").format(
|
||||||
count=len(cable_ids),
|
count=count,
|
||||||
type=self.queryset.model._meta.verbose_name_plural
|
type=self.queryset.model._meta.verbose_name_plural
|
||||||
))
|
))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user