def METHOD_NAME(request, code, slug):
    """Resources tab."""
    locale = get_object_or_404(Locale, code=code)
    project = get_object_or_404(
        Project.objects.visible_for(request.user).available(),
        slug=slug,
    )
    # Amend the parts dict with latest activity info.
    translatedresources_qs = TranslatedResource.objects.filter(
        resource__project=project, locale=locale
    ).prefetch_related("resource", "latest_translation__user")
    if not len(translatedresources_qs):
        raise Http404
    translatedresources = {s.resource.path: s for s in translatedresources_qs}
    translatedresources = dict(list(translatedresources.items()))
    parts = locale.parts_stats(project)
    resource_priority_map = project.resource_priority_map()
    for part in parts:
        part["resource__priority"] = resource_priority_map.get(part["title"], None)
        translatedresource = translatedresources.get(part["title"], None)
        if translatedresource and translatedresource.latest_translation:
            part[
                "latest_activity"
            ] = translatedresource.latest_translation.latest_activity
        else:
            part["latest_activity"] = None
        part["chart"] = {
            "unreviewed_strings": part["unreviewed_strings"],
            "pretranslated_strings": part["pretranslated_strings"],
            "strings_with_errors": part["strings_with_errors"],
            "strings_with_warnings": part["strings_with_warnings"],
            "total_strings": part["resource__total_strings"],
            "approved_strings": part["approved_strings"],
            "approved_share": round(
                part["approved_strings"] / part["resource__total_strings"] * 100
            ),
            "unreviewed_share": round(
                part["unreviewed_strings"] / part["resource__total_strings"] * 100
            ),
            "pretranslated_share": round(
                part["pretranslated_strings"] / part["resource__total_strings"] * 100
            ),
            "errors_share": round(
                part["strings_with_errors"] / part["resource__total_strings"] * 100
            ),
            "warnings_share": round(
                part["strings_with_warnings"] / part["resource__total_strings"] * 100
            ),
            "completion_percent": int(
                math.floor(
                    (
                        part["approved_strings"]
                        + part["pretranslated_strings"]
                        + part["strings_with_warnings"]
                    )
                    / part["resource__total_strings"]
                    * 100
                )
            ),
        }
    return render(
        request,
        "localizations/includes/resources.html",
        {
            "locale": locale,
            "project": project,
            "resources": parts,
            "deadline": any(part["resource__deadline"] for part in parts),
            "priority": any(part["resource__priority"] for part in parts),
        },
    )