Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
oser-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hamza Touizrat
oser-backend
Commits
0b04fde4
Commit
0b04fde4
authored
7 years ago
by
florimondmanca
Browse files
Options
Downloads
Patches
Plain Diff
add project participation cancel endpoint
parent
b4abe860
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/views.py
+14
-1
14 additions, 1 deletion
projects/views.py
with
14 additions
and
1 deletion
projects/views.py
+
14
−
1
View file @
0b04fde4
...
...
@@ -39,7 +39,7 @@ class ProjectViewSet(viewsets.ReadOnlyModelViewSet):
"
id
"
: 1,
"
url
"
:
"
http://localhost:8000/api/projects/1/
"
,
"
name
"
:
"
Oser la Prépa
"
,
"
description
"
:
"
Oser la Prépa est un stage d
'
acclimatation
aux Classes Préparatoires de deux semaines qui se déroule chaque été.
"
,
"
description
"
:
"
Oser la Prépa est un stage d
'
acclimatation
…
"
,
"
logo
"
: null
}
]
...
...
@@ -421,6 +421,19 @@ class ParticipationViewSet(mixins.CreateModelMixin, mixins.DestroyModelMixin,
filter_backends
=
(
filters
.
backends
.
DjangoFilterBackend
,)
filter_fields
=
(
'
user
'
,
'
state
'
,)
@action
(
methods
=
[
'
post
'
],
detail
=
True
)
def
cancel
(
self
,
request
,
pk
=
None
):
"""
Cancel a participation.
Note: the participation is not removed from the database,
it is only marked as cancelled.
Use [destroy](#project-participation-destroy) to delete it.
"""
participation
=
self
.
get_object
()
participation
.
state
=
Participation
.
STATE_CANCELLED
participation
.
save
()
return
Response
(
None
,
status
=
status
.
HTTP_204_NO_CONTENT
)
@action
(
methods
=
[
'
get
'
],
detail
=
True
)
def
form_entry
(
self
,
request
,
pk
=
None
):
"""
Return the answers to the edition form for a participation.
...
...
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