mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Fix #14026: Only get the needed amount of objects
This commit is contained in:
parent
2522056bd1
commit
72f01b3e89
@ -266,6 +266,7 @@ class AvailableObjectsView(ObjectValidationMixin, APIView):
|
||||
|
||||
# Normalize request data to a list of objects
|
||||
requested_objects = request.data if isinstance(request.data, list) else [request.data]
|
||||
limit = len(requested_objects)
|
||||
|
||||
# Serialize and validate the request data
|
||||
serializer = self.write_serializer_class(data=requested_objects, many=True, context={
|
||||
@ -279,7 +280,7 @@ class AvailableObjectsView(ObjectValidationMixin, APIView):
|
||||
)
|
||||
|
||||
with advisory_lock(ADVISORY_LOCK_KEYS[self.advisory_lock_key]):
|
||||
available_objects = self.get_available_objects(parent)
|
||||
available_objects = self.get_available_objects(parent, limit)
|
||||
|
||||
# Determine if the requested number of objects is available
|
||||
if not self.check_sufficient_available(serializer.validated_data, available_objects):
|
||||
|
Loading…
Reference in New Issue
Block a user