Skip to content

Commit 8ba5d03

Browse files
committed
Fixes #7301: Fix exception when deleting a large number of child prefixes
1 parent 879ffd6 commit 8ba5d03

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/release-notes/version-3.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* [#7279](https://github.com/netbox-community/netbox/issues/7279) - Fix exception when tracing cable with no associated path
2626
* [#7282](https://github.com/netbox-community/netbox/issues/7282) - Fix KeyError exception when `INSECURE_SKIP_TLS_VERIFY` is true
2727
* [#7298](https://github.com/netbox-community/netbox/issues/7298) - Restore missing object names from applied object list filters
28+
* [#7301](https://github.com/netbox-community/netbox/issues/7301) - Fix exception when deleting a large number of child prefixes
2829

2930
---
3031

netbox/netbox/views/generic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,10 @@ def post(self, request, **kwargs):
10101010

10111011
# Are we deleting *all* objects in the queryset or just a selected subset?
10121012
if request.POST.get('_all'):
1013+
qs = model.objects.all()
10131014
if self.filterset is not None:
1014-
pk_list = [obj.pk for obj in self.filterset(request.GET, model.objects.only('pk')).qs]
1015-
else:
1016-
pk_list = model.objects.values_list('pk', flat=True)
1015+
qs = self.filterset(request.GET, qs).qs
1016+
pk_list = qs.only('pk').values_list('pk', flat=True)
10171017
else:
10181018
pk_list = [int(pk) for pk in request.POST.getlist('pk')]
10191019

0 commit comments

Comments
 (0)