Merge pull request #21 from chrismeyersfsu/improvement-inventory_script_organization_relationship

added 'organization' to list of related fields for inventory_scripts
This commit is contained in:
Matthew Jones 2015-01-19 10:24:51 -05:00
commit 6cb7f911b7

View File

@ -995,6 +995,14 @@ class CustomInventoryScriptSerializer(BaseSerializer):
ret['script'] = None
return ret
def get_related(self, obj):
res = super(CustomInventoryScriptSerializer, self).get_related(obj)
if obj.organization and obj.organization.active:
res['organization'] = reverse('api:organization_detail', args=(obj.organization.pk,))
return res
class InventorySourceOptionsSerializer(BaseSerializer):
class Meta: