diff --git a/recipes/forms.py b/recipes/forms.py new file mode 100644 index 0000000..1a49779 --- /dev/null +++ b/recipes/forms.py @@ -0,0 +1,9 @@ +from django.forms import ModelForm, BooleanField +from .models import Recipe, Version, Ingredient + +class VersionForm(ModelForm): + class Meta: + model = Version + fields = ['label', 'slug', 'body'] + + # use_author_user = BooleanField(initial=True) diff --git a/recipes/templates/add-version.html b/recipes/templates/add-version.html new file mode 100644 index 0000000..783c5ae --- /dev/null +++ b/recipes/templates/add-version.html @@ -0,0 +1,11 @@ +{% extends "base_main.html" %} +{% block title %}{{ recipe.title }}{% endblock %} +{% block main %} +
+ {% csrf_token %} + + {{ form.as_table }} +
+ +
+ {% endblock %} diff --git a/recipes/templates/recipe.html b/recipes/templates/recipe.html index a500538..0dfa759 100644 --- a/recipes/templates/recipe.html +++ b/recipes/templates/recipe.html @@ -3,7 +3,7 @@ {% block main %}

{{ recipe.title }}

{% if perms.recipes.add_recipe %} -

Add version

+

Add version

{% endif %}