From ec23e431eae019c30aa13ab096bf4d79daef1c62 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Tue, 19 Nov 2019 20:03:34 +0100 Subject: [PATCH] pass ingredients to template --- cookbook/views/edit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/views/edit.py b/cookbook/views/edit.py index c3a56d2ad..f92de2749 100644 --- a/cookbook/views/edit.py +++ b/cookbook/views/edit.py @@ -8,7 +8,7 @@ from django.utils.translation import gettext as _ from django.views.generic import UpdateView, DeleteView from cookbook.forms import ExternalRecipeForm, KeywordForm, StorageForm, SyncForm, InternalRecipeForm, CommentForm -from cookbook.models import Recipe, Sync, Keyword, RecipeImport, Storage, Comment +from cookbook.models import Recipe, Sync, Keyword, RecipeImport, Storage, Comment, RecipeIngredients @login_required @@ -52,8 +52,10 @@ def internal_recipe_update(request, pk): else: form = InternalRecipeForm(instance=recipe_instance) + ingredients = RecipeIngredients.objects.filter(recipe=recipe_instance) + return render(request, 'forms/edit_internal_recipe.html', - {'form': form, 'view_url': reverse('view_recipe', args=[pk])}) + {'form': form, 'ingredients': ingredients, 'view_url': reverse('view_recipe', args=[pk])}) class SyncUpdate(LoginRequiredMixin, UpdateView):