Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix error when calling get_values on an ingredient directly

Roland Geidera1604ba7a1d7
diff --git a/wger/nutrition/forms.py b/wger/nutrition/forms.py
index 13c75ec19..9448ec7c6 100644
--- a/wger/nutrition/forms.py
+++ b/wger/nutrition/forms.py
@@ -41,7 +41,7 @@ class UnitChooserForm(forms.Form):
def __init__(self, *args, **kwargs):
super(UnitChooserForm, self).__init__(*args, **kwargs)
- if len(args) and args[0]['ingredient']:
+ if len(args) and args[0].get('ingredient'):
ingredient_id = args[0]['ingredient']
elif kwargs.get('data'):