(self, search_obj)
Initialize template from a search object.

        Args:
            search_obj (search.Search): a search object.
Initialize template from a search object.
Initialize template from a search object .
def from_search_object(self, search_obj):
        """Initialize template from a search object.

        Args:
            search_obj (search.Search): a search object.
        """
        self._search_id = search_obj.id
        self._sketch_id = search_obj.sketch.id

        response = self.api.fetch_resource_data('searchtemplate/')
        meta = response.get('meta', {})
        template_id = 0
        for data in meta.get('collection', []):
            if data.get('search_id') == self._search_id:
                template_id = data.get('template_id', 0)

        if not template_id:
            return

        self._resource_id = template_id
        self.resource_uri = f'searchtemplate/{self._resource_id}/'
def from_search_object ( self , search_obj ) : self . _search_id = search_obj . id self . _sketch_id = search_obj . sketch . id response = self . api . fetch_resource_data ( 'searchtemplate/' ) meta = response . get ( 'meta' , { } ) template_id = 0 for data in meta . get ( 'collection' , [ ] ) : if data . get ( 'search_id' ) == self . _search_id : template_id = data . get ( 'template_id' , 0 ) if not template_id : return self . _resource_id = template_id self . resource_uri = f'searchtemplate/{self._resource_id}/'