From 31098d1b5ded77c60c01a04221506d64590edaad Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Mon, 13 Feb 2017 14:34:40 -0500 Subject: [PATCH] surface labels related search for job templates --- awx/api/generics.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/api/generics.py b/awx/api/generics.py index 5e81ee7bdb..001b4b0305 100644 --- a/awx/api/generics.py +++ b/awx/api/generics.py @@ -285,7 +285,11 @@ class ListAPIView(generics.ListAPIView, GenericAPIView): if name.endswith('_set'): continue fields.append('{}__search'.format(name)) - for relationship in self.model._meta.local_many_to_many: + m2m_rel = [] + m2m_rel += self.model._meta.local_many_to_many + if issubclass(self.model, UnifiedJobTemplate): + m2m_rel += UnifiedJobTemplate._meta.local_many_to_many + for relationship in m2m_rel: if relationship.related_model._meta.app_label != 'main': continue fields.append('{}__search'.format(relationship.name))