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
f4a51fcb
Commit
f4a51fcb
authored
Feb 05, 2020
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{dev bugfix} added separate validation for checking of atleast 1 approver
parent
cf31da83
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
8 deletions
+39
-8
app/applicationlayer/cms/form/header/views.py
app/applicationlayer/cms/form/header/views.py
+9
-0
app/entities/migrations/0002_auto_20200205_1707.py
app/entities/migrations/0002_auto_20200205_1707.py
+26
-0
app/entities/models.py
app/entities/models.py
+2
-6
app/helper/decorators.py
app/helper/decorators.py
+2
-2
No files found.
app/applicationlayer/cms/form/header/views.py
View file @
f4a51fcb
...
...
@@ -76,6 +76,8 @@ from django.http import HttpResponse
from
xhtml2pdf
import
pisa
from
app.helper.decorators
import
*
from
app.applicationlayer.utils
import
error_message
config
=
configparser
.
ConfigParser
()
config_file
=
os
.
path
.
join
(
'./'
,
'env.ini'
)
...
...
@@ -880,6 +882,13 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
form_code
=
kwargs
[
'form_code'
]
form_data
=
request
.
data
# Restrict a requestor to submit a CR without atleast 1 approver
counter
=
change_request_template
.
validation_existing_approver
(
form_data
[
'frm_approvers'
])
if
counter
==
0
:
return
error_message
(
'400'
,
'Please select at least 1 approver before submitting this request.'
,
'failed'
,
status
.
HTTP_400_BAD_REQUEST
)
# generate batchno history
batchno
=
get_max_batchno
(
"batch"
)
...
...
app/entities/migrations/0002_auto_20200205_1707.py
0 → 100644
View file @
f4a51fcb
# Generated by Django 2.2 on 2020-02-05 17:07
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'entities'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'changerequestformattachments'
,
name
=
'file_upload'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
related_name
=
'form_attachments'
,
to
=
'entities.MasterAttachment'
),
preserve_default
=
False
,
),
migrations
.
AlterField
(
model_name
=
'changerequesttemplateattachments'
,
name
=
'file_upload'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
related_name
=
'template_attachments'
,
to
=
'entities.MasterAttachment'
),
preserve_default
=
False
,
),
]
app/entities/models.py
View file @
f4a51fcb
...
...
@@ -707,9 +707,7 @@ class ChangeRequestTemplateAttachments(BaseAttachment):
file_upload
=
models
.
ForeignKey
(
MasterAttachment
,
on_delete
=
models
.
PROTECT
,
related_name
=
'template_attachments'
,
blank
=
True
,
null
=
True
related_name
=
'template_attachments'
)
template_no
=
models
.
ForeignKey
(
ChangeRequestTemplateHeader
,
...
...
@@ -936,9 +934,7 @@ class ChangeRequestFormAttachments(BaseAttachment):
file_upload
=
models
.
ForeignKey
(
MasterAttachment
,
on_delete
=
models
.
PROTECT
,
related_name
=
'form_attachments'
,
blank
=
True
,
null
=
True
related_name
=
'form_attachments'
)
class
Meta
:
...
...
app/helper/decorators.py
View file @
f4a51fcb
...
...
@@ -354,7 +354,7 @@ def FormValidation(function):
@
wraps
(
function
)
def
wrapper
(
self
,
request
,
*
args
,
**
kwargs
):
form_header
=
request
.
data
required
=
{
'requested_to_template_name'
:
'CR Name'
,
'requested_to_target_date'
:
'Date Required'
,
'requested_to_company'
:
'Company'
,
...
...
@@ -393,7 +393,7 @@ def FormValidation(function):
if
validation_result
is
not
None
:
return
error_message
(
'400'
,
validation_result
+
' is already exist for the same level of approval.'
,
'failed'
,
status
.
HTTP_400_BAD_REQUEST
)
# Restrict a requestor to submit a CR without atleast 1 approver
counter
=
validation_existing_approver
(
frm_approvers
)
if
form_header
[
'status'
]
.
lower
()
==
'pending'
and
counter
==
0
:
...
...
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