diff --git a/recipes/forms.py b/recipes/forms.py index e410308..9889b55 100644 --- a/recipes/forms.py +++ b/recipes/forms.py @@ -38,7 +38,7 @@ class VersionForm(ModelForm): class Meta: model = Version - fields = ['label', 'slug', 'body', 'author'] + fields = ['label', 'slug', 'body', 'author', 'img'] def clean_slug(self): slug = self.cleaned_data['slug'] diff --git a/recipes/models.py b/recipes/models.py index bb9728f..2035fd6 100644 --- a/recipes/models.py +++ b/recipes/models.py @@ -38,6 +38,7 @@ class Version(models.Model): user = models.ForeignKey(User, on_delete=models.PROTECT, null=False, blank=False) author = models.CharField(max_length=30, blank=True) recipe = models.ForeignKey(Recipe, on_delete=models.PROTECT, null=False, blank=False, related_name='versions') + img = models.ImageField(null=True, blank=True) def __str__(self) -> str: return self.recipe.title + ' - ' + self.label diff --git a/recipes/templates/recipe-form.html b/recipes/templates/recipe-form.html index 0fe7ccd..663bb3c 100644 --- a/recipes/templates/recipe-form.html +++ b/recipes/templates/recipe-form.html @@ -19,7 +19,7 @@ {% endcomment %} {% block title %}{{ title }}{% endblock %} {% block main %} -