We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Project+locale AJAX endpoint logic is not uniform
At the moment, `/:code/:slug/ajax/` and `/:code/:slug/ajax/tags/` check if the locale & project exist and are visible to the user, while `/:code/:slug/ajax/contributors/` and `/:code/:slug/ajax/insights/` check that the ProjectLocale exists. [All of these](https://github.com/mozilla/pontoon/blob/master/pontoon/localizations/views.py) should check both conditions.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pontoon/localizations/views.py`
Content:
```
1 import math
2 from operator import attrgetter
3 from django.conf import settings
4 from django.core.exceptions import ImproperlyConfigured
5 from django.db.models import Q
6 from django.http import Http404, HttpResponseRedirect
7 from django.shortcuts import get_object_or_404, render
8 from django.views.generic.detail import DetailView
9 
10 from pontoon.base.models import (
11     Locale,
12     Project,
13     ProjectLocale,
14     TranslatedResource,
15 )
16 from pontoon.base.utils import (
17     require_AJAX,
18     get_project_or_redirect,
19     get_locale_or_redirect,
20 )
21 from pontoon.contributors.views import ContributorsMixin
22 from pontoon.insights.utils import get_insights
23 from pontoon.tags.utils import TagsTool
24 
25 
26 def localization(request, code, slug):
27     """Locale-project overview."""
28     locale = get_locale_or_redirect(
29         code, "pontoon.localizations.localization", "code", slug=slug
30     )
31     if isinstance(locale, HttpResponseRedirect):
32         return locale
33 
34     project = get_project_or_redirect(
35         slug, "pontoon.localizations.localization", "slug", request.user, code=code
36     )
37     if isinstance(project, HttpResponseRedirect):
38         return project
39 
40     project_locale = get_object_or_404(
41         ProjectLocale,
42         locale=locale,
43         project=project,
44     )
45 
46     resource_count = len(locale.parts_stats(project)) - 1
47 
48     return render(
49         request,
50         "localizations/localization.html",
51         {
52             "locale": locale,
53             "project": project,
54             "project_locale": project_locale,
55             "resource_count": resource_count,
56             "tags_count": (
57                 project.tag_set.filter(resources__isnull=False).distinct().count()
58                 if project.tags_enabled
59                 else None
60             ),
61         },
62     )
63 
64 
65 @require_AJAX
66 def ajax_resources(request, code, slug):
67     """Resources tab."""
68     locale = get_object_or_404(Locale, code=code)
69     project = get_object_or_404(
70         Project.objects.visible_for(request.user).available(),
71         slug=slug,
72     )
73 
74     # Amend the parts dict with latest activity info.
75     translatedresources_qs = TranslatedResource.objects.filter(
76         resource__project=project, locale=locale
77     ).prefetch_related("resource", "latest_translation__user")
78 
79     if not len(translatedresources_qs):
80         raise Http404
81 
82     translatedresources = {s.resource.path: s for s in translatedresources_qs}
83     translatedresources = dict(list(translatedresources.items()))
84     parts = locale.parts_stats(project)
85 
86     resource_priority_map = project.resource_priority_map()
87 
88     for part in parts:
89         part["resource__priority"] = resource_priority_map.get(part["title"], None)
90 
91         translatedresource = translatedresources.get(part["title"], None)
92         if translatedresource and translatedresource.latest_translation:
93             part[
94                 "latest_activity"
95             ] = translatedresource.latest_translation.latest_activity
96         else:
97             part["latest_activity"] = None
98 
99         part["chart"] = {
100             "unreviewed_strings": part["unreviewed_strings"],
101             "pretranslated_strings": part["pretranslated_strings"],
102             "strings_with_errors": part["strings_with_errors"],
103             "strings_with_warnings": part["strings_with_warnings"],
104             "total_strings": part["resource__total_strings"],
105             "approved_strings": part["approved_strings"],
106             "approved_share": round(
107                 part["approved_strings"] / part["resource__total_strings"] * 100
108             ),
109             "unreviewed_share": round(
110                 part["unreviewed_strings"] / part["resource__total_strings"] * 100
111             ),
112             "pretranslated_share": round(
113                 part["pretranslated_strings"] / part["resource__total_strings"] * 100
114             ),
115             "errors_share": round(
116                 part["strings_with_errors"] / part["resource__total_strings"] * 100
117             ),
118             "warnings_share": round(
119                 part["strings_with_warnings"] / part["resource__total_strings"] * 100
120             ),
121             "completion_percent": int(
122                 math.floor(
123                     (
124                         part["approved_strings"]
125                         + part["pretranslated_strings"]
126                         + part["strings_with_warnings"]
127                     )
128                     / part["resource__total_strings"]
129                     * 100
130                 )
131             ),
132         }
133 
134     return render(
135         request,
136         "localizations/includes/resources.html",
137         {
138             "locale": locale,
139             "project": project,
140             "resources": parts,
141             "deadline": any(part["resource__deadline"] for part in parts),
142             "priority": any(part["resource__priority"] for part in parts),
143         },
144     )
145 
146 
147 @require_AJAX
148 def ajax_tags(request, code, slug):
149     """Tags tab."""
150     locale = get_object_or_404(Locale, code=code)
151     project = get_object_or_404(Project.objects.visible_for(request.user), slug=slug)
152 
153     if not project.tags_enabled:
154         raise Http404
155 
156     tags_tool = TagsTool(
157         locales=[locale],
158         projects=[project],
159         priority=True,
160     )
161 
162     tags = sorted(tags_tool, key=attrgetter("priority"), reverse=True)
163 
164     return render(
165         request,
166         "localizations/includes/tags.html",
167         {"locale": locale, "project": project, "tags": tags},
168     )
169 
170 
171 @require_AJAX
172 def ajax_insights(request, code, slug):
173     """Insights tab."""
174     if not settings.ENABLE_INSIGHTS:
175         raise ImproperlyConfigured("ENABLE_INSIGHTS variable not set in settings.")
176 
177     pl = get_object_or_404(ProjectLocale, locale__code=code, project__slug=slug)
178     insights = get_insights(locale=pl.locale, project=pl.project)
179 
180     return render(request, "localizations/includes/insights.html", insights)
181 
182 
183 class LocalizationContributorsView(ContributorsMixin, DetailView):
184     """
185     Renders view of contributors for the localization.
186     """
187 
188     template_name = "localizations/includes/contributors.html"
189 
190     def get_object(self):
191         return get_object_or_404(
192             ProjectLocale,
193             locale__code=self.kwargs["code"],
194             project__slug=self.kwargs["slug"],
195         )
196 
197     def get_context_object_name(self, obj):
198         return "projectlocale"
199 
200     def contributors_filter(self, **kwargs):
201         return Q(
202             entity__resource__project=self.object.project, locale=self.object.locale
203         )
204
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pontoon/localizations/views.py b/pontoon/localizations/views.py
--- a/pontoon/localizations/views.py
+++ b/pontoon/localizations/views.py
@@ -71,6 +71,9 @@
         slug=slug,
     )
 
+    # Check if ProjectLocale exists
+    get_object_or_404(ProjectLocale, locale=locale, project=project)
+
     # Amend the parts dict with latest activity info.
     translatedresources_qs = TranslatedResource.objects.filter(
         resource__project=project, locale=locale
@@ -150,6 +153,9 @@
     locale = get_object_or_404(Locale, code=code)
     project = get_object_or_404(Project.objects.visible_for(request.user), slug=slug)
 
+    # Check if ProjectLocale exists
+    get_object_or_404(ProjectLocale, locale=locale, project=project)
+
     if not project.tags_enabled:
         raise Http404
 
@@ -174,6 +180,8 @@
     if not settings.ENABLE_INSIGHTS:
         raise ImproperlyConfigured("ENABLE_INSIGHTS variable not set in settings.")
 
+    get_object_or_404(Locale, code=code)
+    get_object_or_404(Project.objects.visible_for(request.user), slug=slug)
     pl = get_object_or_404(ProjectLocale, locale__code=code, project__slug=slug)
     insights = get_insights(locale=pl.locale, project=pl.project)
 
@@ -188,6 +196,10 @@
     template_name = "localizations/includes/contributors.html"
 
     def get_object(self):
+        get_object_or_404(Locale, code=self.kwargs["code"])
+        get_object_or_404(
+            Project.objects.visible_for(self.request.user), slug=self.kwargs["slug"]
+        )
         return get_object_or_404(
             ProjectLocale,
             locale__code=self.kwargs["code"],

{"golden_diff": "diff --git a/pontoon/localizations/views.py b/pontoon/localizations/views.py\n--- a/pontoon/localizations/views.py\n+++ b/pontoon/localizations/views.py\n@@ -71,6 +71,9 @@\n         slug=slug,\n     )\n \n+    # Check if ProjectLocale exists\n+    get_object_or_404(ProjectLocale, locale=locale, project=project)\n+\n     # Amend the parts dict with latest activity info.\n     translatedresources_qs = TranslatedResource.objects.filter(\n         resource__project=project, locale=locale\n@@ -150,6 +153,9 @@\n     locale = get_object_or_404(Locale, code=code)\n     project = get_object_or_404(Project.objects.visible_for(request.user), slug=slug)\n \n+    # Check if ProjectLocale exists\n+    get_object_or_404(ProjectLocale, locale=locale, project=project)\n+\n     if not project.tags_enabled:\n         raise Http404\n \n@@ -174,6 +180,8 @@\n     if not settings.ENABLE_INSIGHTS:\n         raise ImproperlyConfigured(\"ENABLE_INSIGHTS variable not set in settings.\")\n \n+    get_object_or_404(Locale, code=code)\n+    get_object_or_404(Project.objects.visible_for(request.user), slug=slug)\n     pl = get_object_or_404(ProjectLocale, locale__code=code, project__slug=slug)\n     insights = get_insights(locale=pl.locale, project=pl.project)\n \n@@ -188,6 +196,10 @@\n     template_name = \"localizations/includes/contributors.html\"\n \n     def get_object(self):\n+        get_object_or_404(Locale, code=self.kwargs[\"code\"])\n+        get_object_or_404(\n+            Project.objects.visible_for(self.request.user), slug=self.kwargs[\"slug\"]\n+        )\n         return get_object_or_404(\n             ProjectLocale,\n             locale__code=self.kwargs[\"code\"],\n", "issue": "Project+locale AJAX endpoint logic is not uniform\nAt the moment, `/:code/:slug/ajax/` and `/:code/:slug/ajax/tags/` check if the locale & project exist and are visible to the user, while `/:code/:slug/ajax/contributors/` and `/:code/:slug/ajax/insights/` check that the ProjectLocale exists. [All of these](https://github.com/mozilla/pontoon/blob/master/pontoon/localizations/views.py) should check both conditions.\n", "before_files": [{"content": "import math\nfrom operator import attrgetter\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.db.models import Q\nfrom django.http import Http404, HttpResponseRedirect\nfrom django.shortcuts import get_object_or_404, render\nfrom django.views.generic.detail import DetailView\n\nfrom pontoon.base.models import (\n    Locale,\n    Project,\n    ProjectLocale,\n    TranslatedResource,\n)\nfrom pontoon.base.utils import (\n    require_AJAX,\n    get_project_or_redirect,\n    get_locale_or_redirect,\n)\nfrom pontoon.contributors.views import ContributorsMixin\nfrom pontoon.insights.utils import get_insights\nfrom pontoon.tags.utils import TagsTool\n\n\ndef localization(request, code, slug):\n    \"\"\"Locale-project overview.\"\"\"\n    locale = get_locale_or_redirect(\n        code, \"pontoon.localizations.localization\", \"code\", slug=slug\n    )\n    if isinstance(locale, HttpResponseRedirect):\n        return locale\n\n    project = get_project_or_redirect(\n        slug, \"pontoon.localizations.localization\", \"slug\", request.user, code=code\n    )\n    if isinstance(project, HttpResponseRedirect):\n        return project\n\n    project_locale = get_object_or_404(\n        ProjectLocale,\n        locale=locale,\n        project=project,\n    )\n\n    resource_count = len(locale.parts_stats(project)) - 1\n\n    return render(\n        request,\n        \"localizations/localization.html\",\n        {\n            \"locale\": locale,\n            \"project\": project,\n            \"project_locale\": project_locale,\n            \"resource_count\": resource_count,\n            \"tags_count\": (\n                project.tag_set.filter(resources__isnull=False).distinct().count()\n                if project.tags_enabled\n                else None\n            ),\n        },\n    )\n\n\n@require_AJAX\ndef ajax_resources(request, code, slug):\n    \"\"\"Resources tab.\"\"\"\n    locale = get_object_or_404(Locale, code=code)\n    project = get_object_or_404(\n        Project.objects.visible_for(request.user).available(),\n        slug=slug,\n    )\n\n    # Amend the parts dict with latest activity info.\n    translatedresources_qs = TranslatedResource.objects.filter(\n        resource__project=project, locale=locale\n    ).prefetch_related(\"resource\", \"latest_translation__user\")\n\n    if not len(translatedresources_qs):\n        raise Http404\n\n    translatedresources = {s.resource.path: s for s in translatedresources_qs}\n    translatedresources = dict(list(translatedresources.items()))\n    parts = locale.parts_stats(project)\n\n    resource_priority_map = project.resource_priority_map()\n\n    for part in parts:\n        part[\"resource__priority\"] = resource_priority_map.get(part[\"title\"], None)\n\n        translatedresource = translatedresources.get(part[\"title\"], None)\n        if translatedresource and translatedresource.latest_translation:\n            part[\n                \"latest_activity\"\n            ] = translatedresource.latest_translation.latest_activity\n        else:\n            part[\"latest_activity\"] = None\n\n        part[\"chart\"] = {\n            \"unreviewed_strings\": part[\"unreviewed_strings\"],\n            \"pretranslated_strings\": part[\"pretranslated_strings\"],\n            \"strings_with_errors\": part[\"strings_with_errors\"],\n            \"strings_with_warnings\": part[\"strings_with_warnings\"],\n            \"total_strings\": part[\"resource__total_strings\"],\n            \"approved_strings\": part[\"approved_strings\"],\n            \"approved_share\": round(\n                part[\"approved_strings\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"unreviewed_share\": round(\n                part[\"unreviewed_strings\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"pretranslated_share\": round(\n                part[\"pretranslated_strings\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"errors_share\": round(\n                part[\"strings_with_errors\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"warnings_share\": round(\n                part[\"strings_with_warnings\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"completion_percent\": int(\n                math.floor(\n                    (\n                        part[\"approved_strings\"]\n                        + part[\"pretranslated_strings\"]\n                        + part[\"strings_with_warnings\"]\n                    )\n                    / part[\"resource__total_strings\"]\n                    * 100\n                )\n            ),\n        }\n\n    return render(\n        request,\n        \"localizations/includes/resources.html\",\n        {\n            \"locale\": locale,\n            \"project\": project,\n            \"resources\": parts,\n            \"deadline\": any(part[\"resource__deadline\"] for part in parts),\n            \"priority\": any(part[\"resource__priority\"] for part in parts),\n        },\n    )\n\n\n@require_AJAX\ndef ajax_tags(request, code, slug):\n    \"\"\"Tags tab.\"\"\"\n    locale = get_object_or_404(Locale, code=code)\n    project = get_object_or_404(Project.objects.visible_for(request.user), slug=slug)\n\n    if not project.tags_enabled:\n        raise Http404\n\n    tags_tool = TagsTool(\n        locales=[locale],\n        projects=[project],\n        priority=True,\n    )\n\n    tags = sorted(tags_tool, key=attrgetter(\"priority\"), reverse=True)\n\n    return render(\n        request,\n        \"localizations/includes/tags.html\",\n        {\"locale\": locale, \"project\": project, \"tags\": tags},\n    )\n\n\n@require_AJAX\ndef ajax_insights(request, code, slug):\n    \"\"\"Insights tab.\"\"\"\n    if not settings.ENABLE_INSIGHTS:\n        raise ImproperlyConfigured(\"ENABLE_INSIGHTS variable not set in settings.\")\n\n    pl = get_object_or_404(ProjectLocale, locale__code=code, project__slug=slug)\n    insights = get_insights(locale=pl.locale, project=pl.project)\n\n    return render(request, \"localizations/includes/insights.html\", insights)\n\n\nclass LocalizationContributorsView(ContributorsMixin, DetailView):\n    \"\"\"\n    Renders view of contributors for the localization.\n    \"\"\"\n\n    template_name = \"localizations/includes/contributors.html\"\n\n    def get_object(self):\n        return get_object_or_404(\n            ProjectLocale,\n            locale__code=self.kwargs[\"code\"],\n            project__slug=self.kwargs[\"slug\"],\n        )\n\n    def get_context_object_name(self, obj):\n        return \"projectlocale\"\n\n    def contributors_filter(self, **kwargs):\n        return Q(\n            entity__resource__project=self.object.project, locale=self.object.locale\n        )\n", "path": "pontoon/localizations/views.py"}], "after_files": [{"content": "import math\nfrom operator import attrgetter\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.db.models import Q\nfrom django.http import Http404, HttpResponseRedirect\nfrom django.shortcuts import get_object_or_404, render\nfrom django.views.generic.detail import DetailView\n\nfrom pontoon.base.models import (\n    Locale,\n    Project,\n    ProjectLocale,\n    TranslatedResource,\n)\nfrom pontoon.base.utils import (\n    require_AJAX,\n    get_project_or_redirect,\n    get_locale_or_redirect,\n)\nfrom pontoon.contributors.views import ContributorsMixin\nfrom pontoon.insights.utils import get_insights\nfrom pontoon.tags.utils import TagsTool\n\n\ndef localization(request, code, slug):\n    \"\"\"Locale-project overview.\"\"\"\n    locale = get_locale_or_redirect(\n        code, \"pontoon.localizations.localization\", \"code\", slug=slug\n    )\n    if isinstance(locale, HttpResponseRedirect):\n        return locale\n\n    project = get_project_or_redirect(\n        slug, \"pontoon.localizations.localization\", \"slug\", request.user, code=code\n    )\n    if isinstance(project, HttpResponseRedirect):\n        return project\n\n    project_locale = get_object_or_404(\n        ProjectLocale,\n        locale=locale,\n        project=project,\n    )\n\n    resource_count = len(locale.parts_stats(project)) - 1\n\n    return render(\n        request,\n        \"localizations/localization.html\",\n        {\n            \"locale\": locale,\n            \"project\": project,\n            \"project_locale\": project_locale,\n            \"resource_count\": resource_count,\n            \"tags_count\": (\n                project.tag_set.filter(resources__isnull=False).distinct().count()\n                if project.tags_enabled\n                else None\n            ),\n        },\n    )\n\n\n@require_AJAX\ndef ajax_resources(request, code, slug):\n    \"\"\"Resources tab.\"\"\"\n    locale = get_object_or_404(Locale, code=code)\n    project = get_object_or_404(\n        Project.objects.visible_for(request.user).available(),\n        slug=slug,\n    )\n\n    # Check if ProjectLocale exists\n    get_object_or_404(ProjectLocale, locale=locale, project=project)\n\n    # Amend the parts dict with latest activity info.\n    translatedresources_qs = TranslatedResource.objects.filter(\n        resource__project=project, locale=locale\n    ).prefetch_related(\"resource\", \"latest_translation__user\")\n\n    if not len(translatedresources_qs):\n        raise Http404\n\n    translatedresources = {s.resource.path: s for s in translatedresources_qs}\n    translatedresources = dict(list(translatedresources.items()))\n    parts = locale.parts_stats(project)\n\n    resource_priority_map = project.resource_priority_map()\n\n    for part in parts:\n        part[\"resource__priority\"] = resource_priority_map.get(part[\"title\"], None)\n\n        translatedresource = translatedresources.get(part[\"title\"], None)\n        if translatedresource and translatedresource.latest_translation:\n            part[\n                \"latest_activity\"\n            ] = translatedresource.latest_translation.latest_activity\n        else:\n            part[\"latest_activity\"] = None\n\n        part[\"chart\"] = {\n            \"unreviewed_strings\": part[\"unreviewed_strings\"],\n            \"pretranslated_strings\": part[\"pretranslated_strings\"],\n            \"strings_with_errors\": part[\"strings_with_errors\"],\n            \"strings_with_warnings\": part[\"strings_with_warnings\"],\n            \"total_strings\": part[\"resource__total_strings\"],\n            \"approved_strings\": part[\"approved_strings\"],\n            \"approved_share\": round(\n                part[\"approved_strings\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"unreviewed_share\": round(\n                part[\"unreviewed_strings\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"pretranslated_share\": round(\n                part[\"pretranslated_strings\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"errors_share\": round(\n                part[\"strings_with_errors\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"warnings_share\": round(\n                part[\"strings_with_warnings\"] / part[\"resource__total_strings\"] * 100\n            ),\n            \"completion_percent\": int(\n                math.floor(\n                    (\n                        part[\"approved_strings\"]\n                        + part[\"pretranslated_strings\"]\n                        + part[\"strings_with_warnings\"]\n                    )\n                    / part[\"resource__total_strings\"]\n                    * 100\n                )\n            ),\n        }\n\n    return render(\n        request,\n        \"localizations/includes/resources.html\",\n        {\n            \"locale\": locale,\n            \"project\": project,\n            \"resources\": parts,\n            \"deadline\": any(part[\"resource__deadline\"] for part in parts),\n            \"priority\": any(part[\"resource__priority\"] for part in parts),\n        },\n    )\n\n\n@require_AJAX\ndef ajax_tags(request, code, slug):\n    \"\"\"Tags tab.\"\"\"\n    locale = get_object_or_404(Locale, code=code)\n    project = get_object_or_404(Project.objects.visible_for(request.user), slug=slug)\n\n    # Check if ProjectLocale exists\n    get_object_or_404(ProjectLocale, locale=locale, project=project)\n\n    if not project.tags_enabled:\n        raise Http404\n\n    tags_tool = TagsTool(\n        locales=[locale],\n        projects=[project],\n        priority=True,\n    )\n\n    tags = sorted(tags_tool, key=attrgetter(\"priority\"), reverse=True)\n\n    return render(\n        request,\n        \"localizations/includes/tags.html\",\n        {\"locale\": locale, \"project\": project, \"tags\": tags},\n    )\n\n\n@require_AJAX\ndef ajax_insights(request, code, slug):\n    \"\"\"Insights tab.\"\"\"\n    if not settings.ENABLE_INSIGHTS:\n        raise ImproperlyConfigured(\"ENABLE_INSIGHTS variable not set in settings.\")\n\n    get_object_or_404(Locale, code=code)\n    get_object_or_404(Project.objects.visible_for(request.user), slug=slug)\n    pl = get_object_or_404(ProjectLocale, locale__code=code, project__slug=slug)\n    insights = get_insights(locale=pl.locale, project=pl.project)\n\n    return render(request, \"localizations/includes/insights.html\", insights)\n\n\nclass LocalizationContributorsView(ContributorsMixin, DetailView):\n    \"\"\"\n    Renders view of contributors for the localization.\n    \"\"\"\n\n    template_name = \"localizations/includes/contributors.html\"\n\n    def get_object(self):\n        get_object_or_404(Locale, code=self.kwargs[\"code\"])\n        get_object_or_404(\n            Project.objects.visible_for(self.request.user), slug=self.kwargs[\"slug\"]\n        )\n        return get_object_or_404(\n            ProjectLocale,\n            locale__code=self.kwargs[\"code\"],\n            project__slug=self.kwargs[\"slug\"],\n        )\n\n    def get_context_object_name(self, obj):\n        return \"projectlocale\"\n\n    def contributors_filter(self, **kwargs):\n        return Q(\n            entity__resource__project=self.object.project, locale=self.object.locale\n        )\n", "path": "pontoon/localizations/views.py"}]}