def save(self, *args, **kwargs): logger.warn('Save camp') is_new = False if not self.id: is_new = True super(Campaign, self).save(*args, **kwargs) if is_new: index = graph_db.get_index(Node, self.nodes_index_name) node = index.create('id', str(self.id), {'campaign_id': self.id}) logger.warn(node)
def get(self, id): index = graph_db.get_index(Node, Campaign.nodes_index_name) return index.get('id', str(id))[0]