Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Resint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Resint
Commits
33902cb8
Verified
Commit
33902cb8
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Use get_object_or_404 for delete view to prevent server errors
parent
604bf2bc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/mensa/views.py
+3
-2
3 additions, 2 deletions
aleksis/apps/mensa/views.py
with
3 additions
and
2 deletions
aleksis/apps/mensa/views.py
+
3
−
2
View file @
33902cb8
...
...
@@ -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):
@login_required
@permission_required
(
"
mensa.add_menu
"
)
def
delete
(
request
,
id
):
Menu
.
objects
.
get
(
id
=
id
).
delete
()
menu
=
get_object_or_404
(
Menu
,
pk
=
id
)
menu
.
delete
()
messages
.
success
(
request
,
_
(
"
The menu was deleted successfully.
"
))
return
redirect
(
"
menu_index
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment