diff --git a/recipes/forms.py b/recipes/forms.py index 40afecc..58df282 100644 --- a/recipes/forms.py +++ b/recipes/forms.py @@ -1,4 +1,4 @@ -from django.forms import ModelForm, BooleanField, ValidationError +from django.forms import ModelForm, ValidationError, formset_factory from .models import Recipe, Version, Ingredient class VersionForm(ModelForm): @@ -15,4 +15,9 @@ class VersionForm(ModelForm): raise ValidationError('A recipe version with this slug already exists.') return slug -# use_author_user = BooleanField(initial=True) +class IngredientForm(ModelForm): + class Meta: + model = Ingredient + fields = ['text'] + +IngredientFormSet = formset_factory(IngredientForm, extra=1) diff --git a/recipes/templates/add-version.html b/recipes/templates/add-version.html index 783c5ae..e67d86b 100644 --- a/recipes/templates/add-version.html +++ b/recipes/templates/add-version.html @@ -1,11 +1,40 @@ {% extends "base_main.html" %} {% block title %}{{ recipe.title }}{% endblock %} {% block main %} -