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
4fa4324b
Commit
4fa4324b
authored
Dec 19, 2019
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove extra row generated in csv user_format
parent
11bed26d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
16 deletions
+11
-16
app/applicationlayer/management/batchupload/views.py
app/applicationlayer/management/batchupload/views.py
+7
-7
media/uploads/user_format.csv
media/uploads/user_format.csv
+4
-9
No files found.
app/applicationlayer/management/batchupload/views.py
View file @
4fa4324b
...
...
@@ -223,11 +223,6 @@ class BatchUploadViewSet(viewsets.ModelViewSet):
'Privilege_Department_Code'
)
cols
=
[
'Username'
,
'Name'
,
'Company'
,
'Department'
,
'Department_Code'
]
cols
+=
[
'Email'
,
'Contact_No'
,
'Application'
,
'Default_app'
]
cols
+=
[
'Privilege_Company'
,
'Privilege_Department'
,
'Privilege_Department_Code'
]
cols
+=
[
'Create_CR'
,
'Create_Template'
,
'View_All_CR'
,
'Approve_CR'
]
if
departments
.
count
()
>
0
:
company
=
[
departments
[
0
][
'Privilege_Company'
]]
department
=
[
departments
[
0
][
'Privilege_Department'
]]
...
...
@@ -256,7 +251,12 @@ class BatchUploadViewSet(viewsets.ModelViewSet):
'View_All_CR'
:
[
"Yes"
],
'Approve_CR'
:
[
"Yes"
]
}
cols
=
[
'Username'
,
'Name'
,
'Company'
,
'Department'
,
'Department_Code'
]
cols
+=
[
'Email'
,
'Contact_No'
,
'Application'
,
'Default_app'
]
cols
+=
[
'Privilege_Company'
,
'Privilege_Department'
,
'Privilege_Department_Code'
]
cols
+=
[
'Create_CR'
,
'Create_Template'
,
'View_All_CR'
,
'Approve_CR'
]
df
=
pd
.
DataFrame
(
data
)
header
=
{
"Privilege_Company"
:
[
'Please use this department code as reference'
]}
...
...
@@ -268,7 +268,7 @@ class BatchUploadViewSet(viewsets.ModelViewSet):
)
df_row_reindex
=
pd
.
concat
([
df
,
df3
,
df2
])
df_row_reindex
=
df_row_reindex
.
reindex
(
columns
=
cols
)
df_row_reindex
=
df_row_reindex
.
to_csv
(
index
=
False
)
df_row_reindex
=
df_row_reindex
.
to_csv
(
index
=
False
,
line_terminator
=
'
\n
'
)
updated_file
=
ContentFile
(
df_row_reindex
)
updated_file
.
name
=
"user_format.csv"
...
...
media/uploads/user_format.csv
View file @
4fa4324b
Username,Name,Company,Department,Department_Code,Email,Contact_No,Application,Default_app,Privilege_Company,Privilege_Department,Privilege_Department_Code,Create_CR,Create_Template,View_All_CR,Approve_CR
ob-john,John Doe,Oneberry Technologies Pte Ltd,Admin Department,DEPARTMENT-20191218-0000067,johndoe@gmail.com,123456,"cms,ams",cms,Oneberry Technologies Pte Ltd,Admin Department,DEPARTMENT-20191218-0000067,Yes,No,Yes,Yes
,,,,,,,,,Please use this department code as reference,,,,,,
,,,,,,,,,Oneberry Technologies Pte Ltd,Admin Department,DEPARTMENT-20191218-0000067,,,,
,,,,,,,,,Oneberry Technologies Pte Ltd,Business Development,DEPARTMENT-20191121-0000064,,,,
,,,,,,,,,Jurong Town Corporation,Facilities Management,DEPARTMENT-20191121-0000062,,,,
,,,,,,,,,Jurong Town Corporation,Sample Department,DEPARTMENT-20191218-0000068,,,,
,,,,,,,,,Jurong Town Corporation,Security Division,DEPARTMENT-20191121-0000061,,,,
,,,,,,,,,Jurong Town Corporation,Warehouse Department,DEPARTMENT-20191121-0000065,,,,
Username,Name,Company,Department,Department_Code,Email,Contact_No,Application,Default_app,Privilege_Company,Privilege_Department,Privilege_Department_Code,Create_CR,Create_Template,View_All_CR,Approve_CR
ob-john,John Doe,Oneberry Technologies,Sample Department,DEPARTMENT-20190101-0000000,johndoe@gmail.com,123456,"cms,ams",cms,Oneberry Technologies,Sample Department,DEPARTMENT-20190101-0000000,Yes,No,Yes,Yes
,,,,,,,,,Please use this department code as reference,,,,,,
,,,,,,,,,No Department Data,,,,,,
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