Merge pull request #6712 from AlanCoding/host_sublist

Optimize inventory hosts sublist
This commit is contained in:
Alan Rominger
2017-06-29 11:35:37 -04:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -1966,6 +1966,7 @@ class InventoryHostsList(SubListCreateAttachDetachAPIView):
parent_model = Inventory
relationship = 'hosts'
parent_key = 'inventory'
capabilities_prefetch = ['inventory.admin']
class HostGroupsList(ControlledByScmMixin, SubListCreateAttachDetachAPIView):
@@ -2224,6 +2225,7 @@ class GroupHostsList(ControlledByScmMixin, SubListCreateAttachDetachAPIView):
serializer_class = HostSerializer
parent_model = Group
relationship = 'hosts'
capabilities_prefetch = ['inventory.admin']
def update_raw_data(self, data):
data.pop('inventory', None)
@@ -2250,6 +2252,7 @@ class GroupAllHostsList(SubListAPIView):
serializer_class = HostSerializer
parent_model = Group
relationship = 'hosts'
capabilities_prefetch = ['inventory.admin']
def get_queryset(self):
parent = self.get_parent_object()
@@ -2606,6 +2609,7 @@ class InventorySourceHostsList(SubListAPIView):
parent_model = InventorySource
relationship = 'hosts'
new_in_148 = True
capabilities_prefetch = ['inventory.admin']
class InventorySourceGroupsList(SubListAPIView):
@@ -3934,6 +3938,7 @@ class JobEventHostsList(SubListAPIView):
parent_model = JobEvent
relationship = 'hosts'
view_name = _('Job Event Hosts List')
capabilities_prefetch = ['inventory.admin']
class BaseJobEventsList(SubListAPIView):