def after_update(sender, **kwargs): if 'created' not in kwargs or not kwargs['created']: update_index.delay() else: instance = kwargs['instance'] Essential.objects.create(job=instance, essential=' ') Desireable.objects.create(job=instance, desireable=' ')
def handle_delete(self, sender, instance, **kwargs): try: type_id = self.get_type_id(instance) update_index.delay(instance_id=instance.id, type_id=type_id, ops='remove') except SearchException, e: logger.error('Not updating search index: %s' % e.message)
def handle_save(self, sender, instance, **kwargs): if hasattr(instance, 'is_deleted') and instance.is_deleted: # not updating deleted instance return try: type_id = self.get_type_id(instance) update_index.delay(instance_id=instance.id, type_id=type_id, ops='update') except SearchException, e: logger.error('Not updating search index: %s' % e.message)