def invalidate_object_templates(resource, language, **kwargs):

    if language == resource.source_language:
        langs = resource.available_languages
    else:
        langs = [language]

    # Template lvl cache for resource details
    invalidate_template_cache("resource_details",
        resource.project.slug, resource.slug)

    invalidate_template_cache("project_resource_details",
        resource.project.slug, resource.slug)

    # Number of source strings in resource
    for lang in langs:
        team = Team.objects.get_or_none(resource.project, lang.code)
        if team:
            # Template lvl cache for team details
            invalidate_template_cache("team_details",
                team.id, resource.id)

        for rel in resource.project.releases.all():
            # Template lvl cache for release details
            invalidate_template_cache("release_details",
                rel.id, lang.id)

        # Template lvl cache for resource details
        invalidate_template_cache("resource_details_lang",
            resource.project.slug, resource.slug,
             lang.code)
Invalidate all template level caches related to a specific object
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/resources/handlers.py/invalidate_object_templates