Self hosted FLOSS fitness/workout, nutrition and weight tracker
Only show ingredient units in the current user's language
Roland Geider0bd00b79b7b3
diff --git a/wger/nutrition/templates/units/list.html b/wger/nutrition/templates/units/list.htmlindex 0bc2bd5fa..ca766b3ec 100644--- a/wger/nutrition/templates/units/list.html+++ b/wger/nutrition/templates/units/list.html@@ -39,6 +39,10 @@</td><td>{{unit.name}}</td></tr>+{% empty %}+<tr>+ <td colspan="2">{% trans "No units found" %}</td>+</tr>{% endfor %}</tbody></table>diff --git a/wger/nutrition/views/unit.py b/wger/nutrition/views/unit.pyindex fb46a9705..3e617c28c 100644--- a/wger/nutrition/views/unit.py+++ b/wger/nutrition/views/unit.py@@ -49,6 +49,11 @@ class WeightUnitListView(ListView):template_name = 'units/list.html'context_object_name = 'unit_list'+ def get_queryset(self):+ '''+ Only show ingredient units in the current user's language+ '''+ return WeightUnit.objects.filter(language=load_language())class WeightUnitForm(ModelForm):class Meta: