Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Correctly name result div for ingredient autocompleter

Roland Geider2d6b08048ef7
diff --git a/wger/nutrition/forms.py b/wger/nutrition/forms.py
index 56a3d4d5c..7dc05953c 100644
--- a/wger/nutrition/forms.py
+++ b/wger/nutrition/forms.py
@@ -243,7 +243,7 @@ class MealItemForm(forms.ModelForm):
self.helper.layout = Layout(
'ingredient',
'ingredient_searchfield',
- HTML('<div id="exercise_name"></div>'),
+ HTML('<div id="ingredient_name"></div>'),
Row(
Column('amount', css_class='form-group col-6 mb-0'),
Column('weight_unit', css_class='form-group col-6 mb-0'),
diff --git a/wger/nutrition/static/js/nutrition.js b/wger/nutrition/static/js/nutrition.js
index f854184bb..f4aba0924 100644
--- a/wger/nutrition/static/js/nutrition.js
+++ b/wger/nutrition/static/js/nutrition.js
@@ -71,8 +71,9 @@ function wgerInitIngredientAutocompleter() {
var ingredientId = suggestion.data.id;
// After clicking on a result set the value of the hidden field
+
$('#id_ingredient').val(ingredientId);
- $('#exercise_name').html(suggestion.value);
+ $('#ingredient_name').html(suggestion.value);
// See if the ingredient has any units and set the values for the forms
$.get('/api/v2/ingredientweightunit/?ingredient=' + ingredientId, function (unitData) {