mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 12:18:45 -05:00
basic recipe view
This commit is contained in:
@@ -8,6 +8,20 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h3>{{ recipe.name }}</h3>
|
<h3>{{ recipe.name }}</h3>
|
||||||
|
<br/>
|
||||||
|
<div class="card" style="width: 18rem;">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{% trans 'Ingredients' %}</h5>
|
||||||
|
|
||||||
|
|
||||||
|
{% for i in ingredients %}
|
||||||
|
{{ i.amount }} {{ i.unit }} {{ i.ingredient.name }} <br/>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
{{ recipe.instructions | markdown | safe }}
|
{{ recipe.instructions | markdown | safe }}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ def internal_recipe_update(request, pk):
|
|||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
form = InternalRecipeForm(request.POST)
|
form = InternalRecipeForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
recipe = Recipe()
|
recipe = recipe_instance
|
||||||
recipe.name = form.cleaned_data['name']
|
recipe.name = form.cleaned_data['name']
|
||||||
recipe.instructions = form.cleaned_data['instructions']
|
recipe.instructions = form.cleaned_data['instructions']
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ def internal_recipe_update(request, pk):
|
|||||||
recipe.keywords.set(form.cleaned_data['keywords'])
|
recipe.keywords.set(form.cleaned_data['keywords'])
|
||||||
|
|
||||||
messages.add_message(request, messages.SUCCESS, _('Recipe saved!'))
|
messages.add_message(request, messages.SUCCESS, _('Recipe saved!'))
|
||||||
return redirect('index')
|
return HttpResponseRedirect(reverse('edit_internal_recipe', args=[pk]))
|
||||||
else:
|
else:
|
||||||
messages.add_message(request, messages.ERROR, _('There was an error importing this recipe!'))
|
messages.add_message(request, messages.ERROR, _('There was an error importing this recipe!'))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ def index(request):
|
|||||||
@login_required
|
@login_required
|
||||||
def recipe_view(request, pk):
|
def recipe_view(request, pk):
|
||||||
recipe = get_object_or_404(Recipe, pk=pk)
|
recipe = get_object_or_404(Recipe, pk=pk)
|
||||||
return render(request, 'recipe_view.html', {'recipe': recipe})
|
ingredients = RecipeIngredients.objects.filter(recipe=recipe)
|
||||||
|
|
||||||
|
return render(request, 'recipe_view.html', {'recipe': recipe, 'ingredients': ingredients})
|
||||||
|
|
||||||
|
|
||||||
def test(request):
|
def test(request):
|
||||||
|
|||||||
Reference in New Issue
Block a user