fixup! Add forms for adding recipes and versions

Add ingredients with text only
This commit is contained in:
Benjamin 2023-02-26 22:06:05 +01:00
parent b8000c6ce4
commit bfb5e36d03

View file

@ -56,6 +56,7 @@ def add_version(request, slug_recipe):
version.save()
for ingredient_form in ingredients_formset:
if 'text' in ingredient_form.cleaned_data and ingredient_form.cleaned_data['text']:
ingredient = ingredient_form.save(commit=False)
ingredient.version = version
ingredient.save()