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
3f8c1053
Commit
3f8c1053
authored
Nov 22, 2019
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test delete media file on server attachments
parent
89c72e55
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
9 deletions
+37
-9
app/applicationlayer/cms/utils_cr.py
app/applicationlayer/cms/utils_cr.py
+23
-0
app/applicationlayer/management/batchupload/views.py
app/applicationlayer/management/batchupload/views.py
+1
-1
app/businesslayer/changerequest/change_request.py
app/businesslayer/changerequest/change_request.py
+9
-8
app/entities/models.py
app/entities/models.py
+4
-0
No files found.
app/applicationlayer/cms/utils_cr.py
View file @
3f8c1053
...
...
@@ -473,6 +473,29 @@ def crhistory_log_bulk_delete(queryset, entity, tbl, form_code,
''
)
tbl
.
objects
.
filter
(
id
=
test
[
'id'
])
.
delete
()
return
True
except
IntegrityError
as
exc
:
raise
APIException
(
detail
=
exc
)
def
crhistory_log_bulk_delete_masterattach
(
queryset
,
entity
,
tbl
,
form_code
,
batch_no
,
main_action
):
try
:
for
data
in
queryset
:
test
=
model_to_dict
(
data
)
print
(
test
[
'file_upload'
])
crhistory_save
(
batch_no
,
main_action
,
enums
.
CREnum
.
DELETED
.
value
,
entity
,
form_code
,
test
,
''
)
tbl
.
objects
.
filter
(
id
=
test
[
'id'
])
.
delete
()
models
.
MasterAttachment
.
objects
.
filter
(
id
=
test
[
'file_upload'
])
.
delete
()
return
True
except
IntegrityError
as
exc
:
raise
APIException
(
detail
=
exc
)
...
...
app/applicationlayer/management/batchupload/views.py
View file @
3f8c1053
app/businesslayer/changerequest/change_request.py
View file @
3f8c1053
...
...
@@ -17,6 +17,7 @@ from app.applicationlayer.cms.utils_cr import (
crhistory_save
,
entity_log_bulk
,
crhistory_log_bulk_delete
,
crhistory_log_bulk_delete_masterattach
,
send_mail_requestor
,
next_approver_email
,
send_mail_vendor
,
...
...
@@ -362,7 +363,7 @@ def attachment_add_edit_delete(form_request_body,
)
if
delete_query
.
count
()
>
0
:
crhistory_log_bulk_delete
(
delete_query
,
crhistory_log_bulk_delete
_masterattach
(
delete_query
,
entity
,
queryset
,
form_code
,
...
...
@@ -407,7 +408,7 @@ def attachment_add_edit_delete(form_request_body,
serializer
=
serializer_data
(
frm_instance
,
data
=
data
,
partial
=
partial
,
context
=
{
"request"
:
self
.
request
})
context
=
{
"request"
:
self
.
request
})
serializer
.
is_valid
(
raise_exception
=
True
)
...
...
app/entities/models.py
View file @
3f8c1053
...
...
@@ -526,6 +526,10 @@ class MasterAttachment(models.Model):
class
Meta
:
db_table
=
'master_attachments'
def
delete
(
self
,
*
args
,
**
kwargs
):
self
.
url
.
delete
()
super
()
.
delete
(
*
args
,
**
kwargs
)
class
BaseAttachment
(
models
.
Model
):
attachment_type
=
models
.
CharField
(
max_length
=
255
)
...
...
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