ensure CustomInventoryScripts render correctly in the ActivityStream

This commit is contained in:
Wayne Witzel III 2016-07-11 15:25:35 -04:00
parent fed8a83b08
commit f7e9d07dad
2 changed files with 7 additions and 1 deletions

View File

@ -87,6 +87,7 @@ SUMMARIZABLE_FK_FIELDS = {
'current_update': DEFAULT_SUMMARY_FIELDS + ('status', 'failed', 'license_error'),
'current_job': DEFAULT_SUMMARY_FIELDS + ('status', 'failed', 'license_error'),
'inventory_source': ('source', 'last_updated', 'status'),
'custom_inventory_script': DEFAULT_SUMMARY_FIELDS,
'source_script': ('name', 'description'),
'role': ('id', 'role_field'),
'notification_template': DEFAULT_SUMMARY_FIELDS,
@ -2621,7 +2622,11 @@ class ActivityStreamSerializer(BaseSerializer):
if getattr(obj, fk).exists():
rel[fk] = []
for thisItem in allm2m:
rel[fk].append(reverse('api:' + fk + '_detail', args=(thisItem.id,)))
if fk == 'custom_inventory_script':
rel[fk].append(reverse('api:inventory_script_detail', args=(thisItem.id,)))
else:
rel[fk].append(reverse('api:' + fk + '_detail', args=(thisItem.id,)))
if fk == 'schedule':
rel['unified_job_template'] = thisItem.unified_job_template.get_absolute_url()
return rel

View File

@ -323,6 +323,7 @@ model_serializer_mapping = {
Host: HostSerializer,
Group: GroupSerializer,
InventorySource: InventorySourceSerializer,
CustomInventoryScript: CustomInventoryScriptSerializer,
Credential: CredentialSerializer,
Team: TeamSerializer,
Project: ProjectSerializer,