mirror of
https://github.com/ansible/awx.git
synced 2026-02-17 03:00:04 -03:30
Merge pull request #1662 from AlanCoding/1407_credential_post_fields_rebased
Allow credentials to be created in UI touch up documentation for owners
This commit is contained in:
@@ -1224,6 +1224,10 @@ class CredentialList(ListCreateAPIView):
|
||||
serializer_class = CredentialSerializer
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
for field in [x for x in ['user', 'team', 'organization'] if x in request.data and request.data[x] in ('', None)]:
|
||||
request.data.pop(field)
|
||||
kwargs.pop(field, None)
|
||||
|
||||
if not any([x in request.data for x in ['user', 'team', 'organization']]):
|
||||
return Response({'detail': 'Missing user, team, or organization'}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user