Commit 53f09461e2579eb0c990381b8845a7ff06e03d34

Authored by Gustavo
1 parent f87c08b3

Fix'd create excel file bug

Showing 1 changed file with 9 additions and 4 deletions   Show diff stats
bulletin/views.py
... ... @@ -425,12 +425,17 @@ def create_excel_file(estudantes,metas,meta):
425 425 worksheet.write(contador_estudante,1,nome)
426 426  
427 427 contador_estudante += 1
  428 + path1 = os.path.join(settings.BASE_DIR,'bulletin')
  429 + path2 = os.path.join(path1,'static')
  430 + path3 = os.path.join(path2,'xls')
428 431  
429   - folder_path = join(settings.BASE_DIR, 'bulletin\\static\\xls')
  432 + nome = str(meta.slug) + ".xls"
  433 + folder_path = join(path3, nome)
430 434 #check if the folder already exists
431   - if not os.path.isdir(folder_path):
432   - os.makedirs(folder_path)
433   - workbook.save(settings.BASE_DIR+"\\bulletin\\static\\xls\\"+str(meta.slug)+".xls")
  435 + if not os.path.isdir(path3):
  436 + os.makedirs(path3)
  437 + workbook.save(folder_path)
  438 +
434 439 def read_excel_file(estudante,meta,qtd,boletim):
435 440 nome = boletim.file_content.path
436 441 arquivo = xlrd.open_workbook(nome)
... ...