Verified Commit 33902cb8 authored by Jonathan Weth's avatar Jonathan Weth

Use get_object_or_404 for delete view to prevent server errors

parent 604bf2bc
......@@ -4,7 +4,7 @@ import time
from django.contrib.auth.decorators import login_required, permission_required
from django.http import FileResponse
from django.shortcuts import render, redirect
from django.shortcuts import render, redirect, get_object_or_404
from django.utils import timezone
from .models import Menu
......@@ -34,7 +34,8 @@ def upload(request):
def delete(request, id):
menu = get_object_or_404(Menu, pk=id)
messages.success(request, _("The menu was deleted successfully."))
return redirect("menu_index")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment