Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
ca0ed5e2
Commit
ca0ed5e2
authored
Jan 29, 2020
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restrict a requestor to submit a CR without atleast 1 approver v2
parent
4bacf8a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
app/applicationlayer/cms/form/header/views.py
app/applicationlayer/cms/form/header/views.py
+12
-11
app/applicationlayer/cms/template/header/views.py
app/applicationlayer/cms/template/header/views.py
+5
-1
No files found.
app/applicationlayer/cms/form/header/views.py
View file @
ca0ed5e2
...
...
@@ -1231,23 +1231,24 @@ class ChangeRequestFormPost(APIView):
counter
=
0
for
frm_approver
in
frm_approvers
:
frm_approver
[
'form_code'
]
=
frm_id
counter
=
counter
+
1
if
frm_approver
[
'delegation'
]
not
in
[
'DELEGATION-20191119-0000002'
,
'DELEGATION-20191119-0000001'
]:
counter
=
counter
+
1
data_list_approver
.
append
(
frm_approver
)
if
counter
==
2
and
serializer
.
data
[
'status'
]
.
lower
()
==
'pending'
:
transaction
.
savepoint_rollback
(
sp1
)
message
=
{
'code'
:
400
,
'status'
:
'failed'
,
'message'
:
'Please select at least 1 approver before submitting this request.'
,
}
return
Response
(
message
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
serializerApprover
=
ChangeRequestFormApproversSerializer
(
data
=
data_list_approver
,
many
=
True
)
if
serializerApprover
.
is_valid
(
raise_exception
=
True
):
if
serializer
.
data
[
'status'
]
.
lower
()
==
'pending'
and
counter
==
0
:
transaction
.
savepoint_rollback
(
sp1
)
message
=
{
'code'
:
400
,
'status'
:
'failed'
,
'message'
:
'Please select at least 1 approver before submitting this request.'
,
}
return
Response
(
message
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
serializerApprover
.
save
()
# create form stakes
...
...
app/applicationlayer/cms/template/header/views.py
View file @
ca0ed5e2
...
...
@@ -386,12 +386,16 @@ class ChangeRequestTemplatePost(APIView):
tmp_approver
[
'template_no'
]
=
tmp_id
data_list_approver
.
append
(
tmp_approver
)
# add checking
# Do not allow adding an approver for the same level.
# Message "This approver is already existing for the same level of approval." (CR Temp and CR Form)
serializerApprover
=
ChangeRequestTemplateApproversSerializer
(
data
=
data_list_approver
,
many
=
True
)
if
serializerApprover
.
is_valid
(
raise_exception
=
True
):
serializerApprover
.
save
()
# create template stakes
if
template_header
[
'tmp_stakes'
]:
tmp_stakes
=
template_header
[
'tmp_stakes'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment