@one_perm_required_or_403(pr_resource_translations_delete,
                          (Project, "slug__exact", "project_slug"))
def resource_translations_delete(request, project_slug, resource_slug, lang_code):
    resource = get_object_or_404(Resource, project__slug = project_slug,
                                 slug = resource_slug)

    language = get_object_or_404(Language, code=lang_code)

    # Use a flag to denote if there is an attempt to delete the source language.
    is_source_language = False
    if resource.source_language == language:
        is_source_language = True

    if request.method == 'POST':
        Translation.objects.filter(resource=resource,
            language=language).delete()

        messages.success(request,
                        _("Deleted %(lang)s translation for resource "
                        "%(resource)s.") % {
                          'lang': language.name,
                          'resource': resource.name})
        invalidate_stats_cache(resource, language, user=request.user)
        return HttpResponseRedirect(reverse('resource_detail',
                                    args=[resource.project.slug, resource.slug]),)
    else:
        return render_to_response(
            'resources/resource_translations_confirm_delete.html',
            {'resource': resource,
             'language': language,
             'is_source_language': is_source_language},
            context_instance=RequestContext(request))


# Restrict access only for private projects
# DONT allow anonymous access
Delete the set of Translation objects for a specific Language in a Resource.
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/resources/views.py/resource_translations_delete