mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 02:47:36 -02:30
hit the is_valid method before stripping the special fields in credential view
This commit is contained in:
@@ -1231,6 +1231,11 @@ class CredentialList(ListCreateAPIView):
|
||||
serializer_class = CredentialSerializerCreate
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
||||
# Check the validity of POST data, including special fields
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user