Switches to named GET Parameter for servings

This commit is contained in:
Patrick Magauran
2024-02-13 20:59:04 -05:00
parent a9a3dd6e51
commit cf190734b2
4 changed files with 6 additions and 6 deletions

View File

@@ -130,7 +130,7 @@ def no_perm(request):
return render(request, 'no_perm_info.html')
def recipe_view(request, pk, servings=None, share=None):
def recipe_view(request, pk, share=None):
with scopes_disabled():
recipe = get_object_or_404(Recipe, pk=pk)
@@ -171,7 +171,8 @@ def recipe_view(request, pk, servings=None, 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)
if request.method == "GET":
servings = request.GET.get("servings")
return render(request, 'recipe_view.html',
{'recipe': recipe, 'comments': comments, 'comment_form': comment_form, 'share': share, 'servings': servings })