Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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])
Пример #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)
Пример #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])