Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Contributor analytics
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
hub
hub
Commits
744f9e6f
Commit
744f9e6f
authored
4 years ago
by
Andreas Hubel
Browse files
Options
Downloads
Patches
Plain Diff
event: try to add proper 404 error
parent
52d8792f
No related branches found
No related tags found
1 merge request
!132
Draft: extend api test
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/api/views/events.py
+7
-3
7 additions, 3 deletions
src/api/views/events.py
with
7 additions
and
3 deletions
src/api/views/events.py
+
7
−
3
View file @
744f9e6f
from
rest_framework
import
generics
from
rest_framework
import
generics
,
permissions
,
status
from
rest_framework
import
permissions
from
rest_framework.response
import
Response
from
core.models.events
import
Event
from
core.models.events
import
Event
...
@@ -24,4 +25,7 @@ class EventDetail(ConferenceSlugMixin, generics.RetrieveUpdateDestroyAPIView):
...
@@ -24,4 +25,7 @@ class EventDetail(ConferenceSlugMixin, generics.RetrieveUpdateDestroyAPIView):
def
get_object
(
self
,
**
kwargs
):
def
get_object
(
self
,
**
kwargs
):
event_id
=
self
.
request
.
resolver_match
.
kwargs
[
'
pk
'
]
event_id
=
self
.
request
.
resolver_match
.
kwargs
[
'
pk
'
]
try
:
return
Event
.
objects
.
accessible_by_user
(
user
=
self
.
request
.
user
,
conference
=
self
.
conference
).
get
(
pk
=
event_id
)
return
Event
.
objects
.
accessible_by_user
(
user
=
self
.
request
.
user
,
conference
=
self
.
conference
).
get
(
pk
=
event_id
)
except
Event
.
DoesNotExist
:
return
Response
(
status
=
status
.
HTTP_404_NOT_FOUND
)
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