mirror of
https://github.com/ansible/awx.git
synced 2026-02-14 17:50:02 -03:30
Fixup attach logic for inventory hosts/groups on subcollections. Pass serializer errors through on conflict scenarios.
This commit is contained in:
@@ -372,4 +372,21 @@ class GroupsDetail(BaseDetail):
|
||||
serializer_class = GroupSerializer
|
||||
permission_classes = (CustomRbac,)
|
||||
|
||||
class InventoryGroupsList(BaseSubList):
|
||||
|
||||
model = Group
|
||||
serializer_class = GroupSerializer
|
||||
permission_classes = (CustomRbac,)
|
||||
# to allow the sub-aspect listing
|
||||
parent_model = Inventory
|
||||
relationship = 'groups'
|
||||
# to allow posting to this resource to create resources
|
||||
postable = True
|
||||
# FIXME: go back and add these to other SubLists
|
||||
inject_primary_key_on_post_as = 'inventory'
|
||||
|
||||
def _get_queryset(self):
|
||||
# FIXME: more DRY methods like this
|
||||
return Inventory._filter_queryset(Inventory.objects.get(pk=self.kwargs['pk']).groups)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user