Commit 4fa4324b authored by Gladys Forte's avatar Gladys Forte

remove extra row generated in csv user_format

parent 11bed26d
......@@ -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"
......
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,,,,,,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment