pass ingredients to template

This commit is contained in:
vabene1111 2019-11-19 20:03:34 +01:00
parent 8eca629410
commit ec23e431ea

View File

@ -8,7 +8,7 @@ from django.utils.translation import gettext as _
from django.views.generic import UpdateView, DeleteView from django.views.generic import UpdateView, DeleteView
from cookbook.forms import ExternalRecipeForm, KeywordForm, StorageForm, SyncForm, InternalRecipeForm, CommentForm 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 @login_required
@ -52,8 +52,10 @@ def internal_recipe_update(request, pk):
else: else:
form = InternalRecipeForm(instance=recipe_instance) form = InternalRecipeForm(instance=recipe_instance)
ingredients = RecipeIngredients.objects.filter(recipe=recipe_instance)
return render(request, 'forms/edit_internal_recipe.html', 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): class SyncUpdate(LoginRequiredMixin, UpdateView):