Add serving size to recipe url so it loads with num

This commit is contained in:
Patrick Magauran
2024-02-06 22:21:37 -05:00
parent 29438109a6
commit 13f532a67b
4 changed files with 13 additions and 5 deletions

View File

@ -130,7 +130,7 @@ def no_perm(request):
return render(request, 'no_perm_info.html')
def recipe_view(request, pk, share=None):
def recipe_view(request, pk, servings=None, share=None):
with scopes_disabled():
recipe = get_object_or_404(Recipe, pk=pk)
@ -171,9 +171,9 @@ def recipe_view(request, pk, share=None):
created_at__gt=(timezone.now() - timezone.timedelta(minutes=5)),
space=request.space).exists():
ViewLog.objects.create(recipe=recipe, created_by=request.user, space=request.space)
return render(request, 'recipe_view.html',
{'recipe': recipe, 'comments': comments, 'comment_form': comment_form, 'share': share, })
{'recipe': recipe, 'comments': comments, 'comment_form': comment_form, 'share': share, 'servings': servings })
@group_required('user')