Last active
March 28, 2018 09:56
-
-
Save mathjazz/e191e7136a37c6dd89696a9840a53c22 to your computer and use it in GitHub Desktop.
Redirect all-projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pontoon/base/views.py b/pontoon/base/views.py | |
index a9c1076..066ba19 100755 | |
--- a/pontoon/base/views.py | |
+++ b/pontoon/base/views.py | |
@@ -113,15 +113,21 @@ def translate(request, locale, slug, part): | |
def translate_locale_agnostic(request, slug, part): | |
"""Locale Agnostic Translate view.""" | |
user = request.user | |
- project = get_object_or_404(Project.objects.available(), slug=slug) | |
+ | |
+ if slug.lower() == 'all-projects': | |
+ project_locales = Locale.objects.available() | |
+ else: | |
+ project = get_object_or_404(Project.objects.available(), slug=slug) | |
+ project_locales = project.locales | |
if user.is_authenticated(): | |
locale = user.profile.custom_homepage | |
- if locale and project.locales.filter(code=locale).exists(): | |
+ if locale and project_locales.filter(code=locale).exists(): | |
return redirect('pontoon.translate', slug=slug, locale=locale, part=part) | |
- locale = utils.get_project_locale_from_request(request, project.locales) | |
+ locale = utils.get_project_locale_from_request(request, project_locales) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment