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
dd701733
Commit
dd701733
authored
Oct 08, 2019
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added file upload on form
parent
475d6c94
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
app/applicationlayer/cms/form/header/views.py
app/applicationlayer/cms/form/header/views.py
+47
-1
app/applicationlayer/cms/master/template/account/views.py
app/applicationlayer/cms/master/template/account/views.py
+1
-1
No files found.
app/applicationlayer/cms/form/header/views.py
View file @
dd701733
...
...
@@ -793,7 +793,7 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
the_last_vendor
=
models
.
ChangeRequestFormApprovers
.
objects
.
filter
(
form_code
=
form_code
,
delegation
=
'Vendor/Implementor'
)
.
order_by
(
'level'
)
.
last
()
if
(
current_user
==
the_last_vendor
.
user
.
code
and
level
==
the_last_vendor
.
level
):
models
.
ChangeRequestFormHeader
.
objects
.
filter
(
...
...
@@ -1249,6 +1249,52 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
return
Response
(
message
,
status
=
status
.
HTTP_500_INTERNAL_SERVER_ERROR
)
@
transaction
.
atomic
()
@
action
(
methods
=
[
'POST'
],
detail
=
True
,
url_path
=
'file_upload'
,
url_name
=
'file_upload'
)
def
file_upload
(
self
,
request
,
*
args
,
**
kwargs
):
try
:
attach_body
=
request
.
data
form_code
=
kwargs
[
'form_code'
]
id_number
=
self
.
request
.
user
.
code
data_list_attach
=
[]
# create form attachments
if
attach_body
[
'attachments'
]:
frm_attachments
=
attach_body
[
'attachments'
]
for
frm_attachment
in
frm_attachments
:
frm_attachment
[
'form_code'
]
=
form_code
frm_attachment
[
'uploaded_by'
]
=
id_number
data_list_attach
.
append
(
frm_attachment
)
serializerAttach
=
ChangeRequestFormAttachmentsSerializer
(
data
=
data_list_attach
,
many
=
True
)
if
serializerAttach
.
is_valid
(
raise_exception
=
True
):
serializerAttach
.
save
()
message
=
status_message_response
(
200
,
'success'
,
'New Attachments successfully saved!'
,
serializerAttach
.
data
)
return
Response
(
message
,
status
=
status
.
HTTP_200_OK
)
except
Exception
as
e
:
message
=
status_message_response
(
500
,
'failed'
,
'Request was not able to process'
+
str
(
e
),
[]
)
return
Response
(
message
,
status
=
status
.
HTTP_500_INTERNAL_SERVER_ERROR
)
class
ChangeRequestFormPost
(
APIView
):
@
transaction
.
atomic
()
...
...
app/applicationlayer/cms/master/template/account/views.py
View file @
dd701733
...
...
@@ -19,7 +19,7 @@ class UserListTemplate(APIView):
user_codes
=
models
.
User
.
objects
.
filter
(
department
=
dept
)
.
values
(
'code'
)
.
exclude
(
id
=
1
)
verified_users
=
models
.
AllowedCompany
.
objects
.
filter
(
Q
(
id_number__in
=
user_codes
)
&
Q
(
create_change_request_template
=
True
)
...
...
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