fixed missing servings get parameter breaking view in some cases
This commit is contained in:
parent
f6607aa2e3
commit
6de68707ed
@ -50,7 +50,7 @@ def index(request):
|
|||||||
|
|
||||||
# TODO need to deprecate
|
# TODO need to deprecate
|
||||||
def search(request):
|
def search(request):
|
||||||
if has_group_permission(request.user, ('guest', )):
|
if has_group_permission(request.user, ('guest',)):
|
||||||
return render(request, 'search.html', {})
|
return render(request, 'search.html', {})
|
||||||
else:
|
else:
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
@ -130,7 +130,7 @@ def recipe_view(request, pk, share=None):
|
|||||||
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
|
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
|
||||||
return HttpResponseRedirect(reverse('account_login') + '?next=' + request.path)
|
return HttpResponseRedirect(reverse('account_login') + '?next=' + request.path)
|
||||||
|
|
||||||
if not (has_group_permission(request.user, ('guest', )) and recipe.space == request.space) and not share_link_valid(recipe, share):
|
if not (has_group_permission(request.user, ('guest',)) and recipe.space == request.space) and not share_link_valid(recipe, share):
|
||||||
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
|
messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!'))
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
@ -157,11 +157,11 @@ def recipe_view(request, pk, share=None):
|
|||||||
if not ViewLog.objects.filter(recipe=recipe, created_by=request.user, created_at__gt=(timezone.now() - timezone.timedelta(minutes=5)), space=request.space).exists():
|
if not ViewLog.objects.filter(recipe=recipe, created_by=request.user, 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)
|
ViewLog.objects.create(recipe=recipe, created_by=request.user, space=request.space)
|
||||||
|
|
||||||
if request.method == "GET":
|
servings = recipe.servings
|
||||||
|
if request.method == "GET" and 'servings' in request.GET:
|
||||||
servings = request.GET.get("servings")
|
servings = request.GET.get("servings")
|
||||||
return render(request, 'recipe_view.html',
|
return render(request, 'recipe_view.html',
|
||||||
{'recipe': recipe, 'comments': comments, 'comment_form': comment_form, 'share': share, 'servings': servings })
|
{'recipe': recipe, 'comments': comments, 'comment_form': comment_form, 'share': share, 'servings': servings})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@group_required('user')
|
@group_required('user')
|
||||||
@ -451,19 +451,19 @@ def web_manifest(request):
|
|||||||
|
|
||||||
manifest_info = {
|
manifest_info = {
|
||||||
"name":
|
"name":
|
||||||
theme_values['app_name'], "short_name":
|
theme_values['app_name'], "short_name":
|
||||||
theme_values['app_name'], "description":
|
theme_values['app_name'], "description":
|
||||||
_("Manage recipes, shopping list, meal plans and more."), "icons":
|
_("Manage recipes, shopping list, meal plans and more."), "icons":
|
||||||
icons, "start_url":
|
icons, "start_url":
|
||||||
"./search", "background_color":
|
"./search", "background_color":
|
||||||
theme_values['nav_bg_color'], "display":
|
theme_values['nav_bg_color'], "display":
|
||||||
"standalone", "scope":
|
"standalone", "scope":
|
||||||
".", "theme_color":
|
".", "theme_color":
|
||||||
theme_values['nav_bg_color'], "shortcuts":
|
theme_values['nav_bg_color'], "shortcuts":
|
||||||
[{"name": _("Plan"), "short_name": _("Plan"), "description": _("View your meal Plan"), "url":
|
[{"name": _("Plan"), "short_name": _("Plan"), "description": _("View your meal Plan"), "url":
|
||||||
"./plan"}, {"name": _("Books"), "short_name": _("Books"), "description": _("View your cookbooks"), "url": "./books"},
|
"./plan"}, {"name": _("Books"), "short_name": _("Books"), "description": _("View your cookbooks"), "url": "./books"},
|
||||||
{"name": _("Shopping"), "short_name": _("Shopping"), "description": _("View your shopping lists"), "url":
|
{"name": _("Shopping"), "short_name": _("Shopping"), "description": _("View your shopping lists"), "url":
|
||||||
"./list/shopping-list/"}], "share_target": {"action": "/data/import/url", "method": "GET", "params": {"title": "title", "url": "url", "text": "text"}}
|
"./list/shopping-list/"}], "share_target": {"action": "/data/import/url", "method": "GET", "params": {"title": "title", "url": "url", "text": "text"}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonResponse(manifest_info, json_dumps_params={'indent': 4})
|
return JsonResponse(manifest_info, json_dumps_params={'indent': 4})
|
||||||
|
Loading…
Reference in New Issue
Block a user