add TODOs

This commit is contained in:
Benjamin 2023-03-04 13:13:08 +01:00
parent bb01945c6c
commit 818df6f263
2 changed files with 2 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{% extends "base_main.html" %} {% extends "base_main.html" %}
{% block title %}{{ recipe.title }}{% endblock %} {% block title %}{{ recipe.title }}{% endblock %}
{% block main %} {% block main %}
<form action="" method="post" id="edit-version-form"> <form action="" method="post" id="edit-version-form"> <!-- TODO refactor with add-version.html-->
{%csrf_token %} {%csrf_token %}
<table> <table>
{{ version_form.as_table }} {{ version_form.as_table }}

View file

@ -78,7 +78,7 @@ def edit_version(request, slug_recipe, slug_version):
recipe = get_object_or_404(Recipe, slug=slug_recipe) recipe = get_object_or_404(Recipe, slug=slug_recipe)
version = get_object_or_404(Version, recipe=recipe, slug=slug_version) version = get_object_or_404(Version, recipe=recipe, slug=slug_version)
if request.method == 'POST': if request.method == 'POST': # TODO refactor with add_version
version_form = VersionForm(request.POST, prefix=VERSION_FORM_PREFIX, instance=version) version_form = VersionForm(request.POST, prefix=VERSION_FORM_PREFIX, instance=version)
ingredients_formset = IngredientFormSet(request.POST, queryset=version.ingredients.all(), prefix=INGREDIENTS_FORMSET_PREFIX) # type: ignore ingredients_formset = IngredientFormSet(request.POST, queryset=version.ingredients.all(), prefix=INGREDIENTS_FORMSET_PREFIX) # type: ignore
version_form.recipe_id = recipe.id # type: ignore version_form.recipe_id = recipe.id # type: ignore