def add_or_update(self, *items): """ Given an item, adds it to the index, or updates it if it's already in the index. """ self.stdout.write("Adding or updating item(s): %s\n" % list(items)) # Use Celery to add or update the item asynchronously if self.type == Opinion: add_or_update_opinions.delay(items) elif self.type == Audio: add_or_update_audio_files.delay(items)
def save(self, index=True, force_commit=False, *args, **kwargs): super(Opinion, self).save(*args, **kwargs) if index: from cl.search.tasks import add_or_update_opinions add_or_update_opinions.delay([self.pk], force_commit)
def save_model(self, request, obj, form, change): obj.save() from cl.search.tasks import add_or_update_opinions add_or_update_opinions.delay([obj.citing_opinion_id], force_commit=False)
def save_model(self, request, obj, form, change): obj.save() from cl.search.tasks import add_or_update_opinions add_or_update_opinions.delay([obj.pk])