def update_search_text(self, save=True): super(Foto, self).update_search_text(save=False) if "tags" in self._data: tags = [] for user_id, user in Es.by_ids(self._data["tags"]).iteritems(): tags.extend((user.first_name, user.last_name)) self._search_text += " ".join(filter(bool, tags)) if save: self.save()
def update_search_text(self, save=True): super(Foto, self).update_search_text(save=False) if 'tags' in self._data: tags = [] for user_id, user in six.iteritems(Es.by_ids(self._data['tags'])): tags.extend((user.first_name, user.last_name)) self._search_text += ' '.join(filter(bool, tags)) if save: self.save()
def get_tags(self): """ Return all tags of this entity (as User object) """ if "tags" not in self._data: return None idmap = Es.by_ids(self._data["tags"]) people = [] for id in self._data["tags"]: people.append(idmap[id]) return people
def get_tags(self): ''' Return all tags of this entity (as User object) ''' if 'tags' not in self._data: return None idmap = Es.by_ids(self._data['tags']) people = [] for id in self._data['tags']: people.append(idmap[id]) return people