Пример #1
0
def handle_m2m_save(sender, **kwargs):
    """Update index when taxonomies are updated."""
    from search.search_indexes import get_vocabs
    instance = kwargs.pop("instance")
    if instance.__class__.__name__ != "LearningResource":
        return
    # Update cache for the LearningResource if it's already set.
    get_vocabs(instance.id)
    # Update Elasticsearch index:
    from search.utils import index_resources
    index_resources([instance.id])
Пример #2
0
def handle_m2m_save(sender, **kwargs):
    """Update index when taxonomies are updated."""
    from search.search_indexes import get_vocabs

    instance = kwargs.pop("instance")
    if instance.__class__.__name__ != "LearningResource":
        return
    # Update cache for the LearningResource if it's already set.
    get_vocabs(instance.id)
    # Update Elasticsearch index:
    from search.utils import index_resources

    index_resources([instance.id])
Пример #3
0
 def three_times():
     """Get vocab data three times."""
     for _ in range(0, 3):
         get_vocabs(self.resource.id)