Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 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])
Example #6
0
    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)
Example #7
0
 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])