Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix error when generating the language switcher links

Roland Geiderf49f3c5a792b
diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html
index 81d8ef5f7..4987584a5 100644
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@ -167,6 +167,8 @@
{# #}
{# Render the links to the other languages #}
{# #}
+
+ {% if not is_api_path %} {# Don't show language switcher in the generated API views #}
<div class="btn-group float-right" role="group">
<div class="btn-group" role="group">
<button id="btnGroupLanguages2" type="button" class="btn btn-link text-muted small dropdown-toggle btn-sm" data-toggle="dropdown">
@@ -192,6 +194,7 @@
</div>
</div>
</div>
+ {% endif %}
<ul class="list-unstyled mb-0 pt-2">
<li><a href="{% url 'core:about' %}" class="text-muted small">{% trans "About" %}</a></li>
diff --git a/wger/utils/context_processor.py b/wger/utils/context_processor.py
index 1ec56b227..c6ebf0a82 100644
--- a/wger/utils/context_processor.py
+++ b/wger/utils/context_processor.py
@@ -56,6 +56,7 @@ def processor(request):
# Translation links
'i18n_path': i18n_path,
+ 'is_api_path': '/api/' in request.build_absolute_uri(),
# Flag for guest users
'has_demo_data': request.session.get('has_demo_data', False),