diff --git a/recipes/forms.py b/recipes/forms.py index 58df282..81809aa 100644 --- a/recipes/forms.py +++ b/recipes/forms.py @@ -1,12 +1,14 @@ -from django.forms import ModelForm, ValidationError, formset_factory +from django.forms import ModelForm, ValidationError, formset_factory, BooleanField from .models import Recipe, Version, Ingredient class VersionForm(ModelForm): recipe_id: int + use_user_for_author = BooleanField(initial=True, label='I am the author', required=False) + class Meta: model = Version - fields = ['label', 'slug', 'body'] + fields = ['label', 'slug', 'body', 'author_name'] def clean_slug(self): recipe = Recipe.objects.get(id=self.recipe_id) diff --git a/recipes/templates/add-version.html b/recipes/templates/add-version.html index e67d86b..7f8b8f7 100644 --- a/recipes/templates/add-version.html +++ b/recipes/templates/add-version.html @@ -15,6 +15,26 @@