1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

use credential property that returns integers

This commit is contained in:
AlanCoding 2017-12-13 12:41:32 -05:00
parent 9dbcc5934e
commit f4f1e0fd3c
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

View File

@ -2385,14 +2385,14 @@ class JobOptionsSerializer(LabelsListMixin, BaseSerializer):
try:
if obj.credential:
res['credential'] = self.reverse(
'api:credential_detail', kwargs={'pk': obj.credential.pk}
'api:credential_detail', kwargs={'pk': obj.credential}
)
except ObjectDoesNotExist:
setattr(obj, 'credential', None)
try:
if obj.vault_credential:
res['vault_credential'] = self.reverse(
'api:credential_detail', kwargs={'pk': obj.vault_credential.pk}
'api:credential_detail', kwargs={'pk': obj.vault_credential}
)
except ObjectDoesNotExist:
setattr(obj, 'vault_credential', None)