From 32b6e887896cd5cee3989bb5e44e1e322db59eb1 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Sat, 29 Jul 2017 00:49:38 -0300 Subject: [PATCH] Adjusts in the excel file creation --- bulletin/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bulletin/views.py b/bulletin/views.py index 52b947f..26c1481 100644 --- a/bulletin/views.py +++ b/bulletin/views.py @@ -282,9 +282,10 @@ class CreateView(LoginRequiredMixin, LogMixin, generic.edit.CreateView): meta_geral = Goals.objects.get(topic=topic) metas = GoalItem.objects.filter(goal = meta_geral) - itens_da_meta = list(metas) + itens_da_meta = sorted(list(metas), key = lambda met: met.id) alunos = meta_geral.topic.subject.students.all() create_excel_file(alunos, itens_da_meta,meta_geral) + context['goal_file'] = str(meta_geral.slug)+".xls" return context @@ -324,11 +325,11 @@ def create_excel_file(estudantes,metas,meta): contador_estudante += 1 - folder_path = join(settings.BASE_DIR, 'bulletin\\localfiles') + folder_path = join(settings.BASE_DIR, 'bulletin\\static\\xls') #check if the folder already exists if not os.path.isdir(folder_path): os.makedirs(folder_path) - workbook.save(settings.BASE_DIR+"\\bulletin\\localfiles\\"+str(meta.slug)+".xls") + workbook.save(settings.BASE_DIR+"\\bulletin\\static\\xls\\"+str(meta.slug)+".xls") -- libgit2 0.21.2