diff --git a/cookbook/serializer.py b/cookbook/serializer.py
index 2fbf11c4d..4b9a21d1c 100644
--- a/cookbook/serializer.py
+++ b/cookbook/serializer.py
@@ -147,7 +147,7 @@ class NutritionInformationSerializer(serializers.ModelSerializer):
class RecipeSerializer(WritableNestedModelSerializer):
- nutrition = NutritionInformationSerializer(allow_null=True)
+ nutrition = NutritionInformationSerializer(allow_null=True, required=False)
steps = StepSerializer(many=True)
keywords = KeywordSerializer(many=True)
diff --git a/cookbook/templates/forms/edit_internal_recipe.html b/cookbook/templates/forms/edit_internal_recipe.html
index 50574fcc2..9bd0f4853 100644
--- a/cookbook/templates/forms/edit_internal_recipe.html
+++ b/cookbook/templates/forms/edit_internal_recipe.html
@@ -87,10 +87,10 @@
{% trans 'Nutrition' %}
@@ -104,7 +104,7 @@
-
+
@@ -347,7 +347,7 @@
+ :id="'id_instruction_' + step.id">
{% trans 'You can use markdown to format this field. See the docs here' %}
@@ -364,7 +364,10 @@
+ class="btn btn-primary shadow-none"
+ v-if="recipe.nutrition === null">{% trans 'Add Nutrition' %}
+
{% trans 'View Recipe' %}
{% trans 'Add Step' %}
+ class="btn btn-primary btn-block shadow-none"
+ v-if="recipe.nutrition === null">{% trans 'Add Nutrition' %}
+
{% trans 'View Recipe' %}
@@ -488,8 +494,8 @@
e.preventDefault(); // present "Save Page" from getting triggered.
for (el of e.path) {
- if(el.id !== undefined && el.id.includes('id_card_step_')) {
- let step = this.recipe.steps[el.id.replace('id_card_step_','')]
+ if (el.id !== undefined && el.id.includes('id_card_step_')) {
+ let step = this.recipe.steps[el.id.replace('id_card_step_', '')]
this.addIngredient(step)
}
}
@@ -685,8 +691,8 @@
addNutrition: function () {
this.recipe.nutrition = {}
},
- removeNutrition: function() {
- this.recipe.nutrition = undefined
+ removeNutrition: function () {
+ this.recipe.nutrition = null
}
}
});