Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
5d80c3b2
Commit
5d80c3b2
authored
4 years ago
by
sks444
Browse files
Options
Downloads
Patches
Plain Diff
Fix screening apis to remove pagination and accept id for post
parent
9f4ff1cb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hypha/apply/api/v1/screening/views.py
+6
-5
6 additions, 5 deletions
hypha/apply/api/v1/screening/views.py
with
6 additions
and
5 deletions
hypha/apply/api/v1/screening/views.py
+
6
−
5
View file @
5d80c3b2
...
...
@@ -9,7 +9,6 @@ from rest_framework_api_key.permissions import HasAPIKey
from
hypha.apply.funds.models
import
ScreeningStatus
from
..mixin
import
SubmissionNestedMixin
from
..pagination
import
StandardResultsSetPagination
from
..permissions
import
IsApplyStaffUser
from
.filters
import
ScreeningStatusFilter
from
.serializers
import
(
...
...
@@ -25,7 +24,7 @@ class ScreeningStatusViewSet(viewsets.ReadOnlyModelViewSet):
)
filter_backends
=
(
filters
.
DjangoFilterBackend
,)
filter_class
=
ScreeningStatusFilter
pagination_class
=
StandardResultsSetPaginati
on
pagination_class
=
N
on
e
queryset
=
ScreeningStatus
.
objects
.
all
()
serializer_class
=
ScreeningStatusListSerializer
...
...
@@ -40,17 +39,18 @@ class SubmissionScreeningStatusViewSet(
HasAPIKey
|
permissions
.
IsAuthenticated
,
HasAPIKey
|
IsApplyStaffUser
,
)
serializer_class
=
ScreeningStatusListSerializer
pagination_class
=
None
def
get_queryset
(
self
):
submission
=
self
.
get_submission_object
()
return
submission
.
screening_statuses
.
all
()
def
create
(
self
,
request
,
*
args
,
**
kwargs
):
ser
=
self
.
get_s
erializer
(
data
=
request
.
data
)
ser
=
ScreeningStatusS
erializer
(
data
=
request
.
data
)
ser
.
is_valid
(
raise_exception
=
True
)
submission
=
self
.
get_submission_object
()
screening_status
=
get_object_or_404
(
ScreeningStatus
,
title
=
ser
.
validated_data
[
'
title
'
]
ScreeningStatus
,
id
=
ser
.
validated_data
[
'
id
'
]
)
if
not
submission
.
screening_statuses
.
filter
(
default
=
True
).
exists
():
raise
ValidationError
({
'
detail
'
:
"
Can
'
t set screening status without default being set
"
})
...
...
@@ -62,7 +62,8 @@ class SubmissionScreeningStatusViewSet(
submission
.
screening_statuses
.
add
(
screening_status
)
return
Response
(
status
=
status
.
HTTP_201_CREATED
)
ser
=
self
.
get_serializer
(
submission
.
screening_statuses
.
all
(),
many
=
True
)
return
Response
(
ser
.
data
,
status
=
status
.
HTTP_201_CREATED
)
@action
(
detail
=
False
,
methods
=
[
'
post
'
])
def
default
(
self
,
request
,
*
args
,
**
kwargs
):
...
...
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