Commit 32b6e887896cd5cee3989bb5e44e1e322db59eb1

Authored by Gustavo
1 parent 3bb53c3a

Adjusts in the excel file creation

Showing 1 changed file with 4 additions and 3 deletions   Show diff stats
bulletin/views.py
... ... @@ -282,9 +282,10 @@ class CreateView(LoginRequiredMixin, LogMixin, generic.edit.CreateView):
282 282  
283 283 meta_geral = Goals.objects.get(topic=topic)
284 284 metas = GoalItem.objects.filter(goal = meta_geral)
285   - itens_da_meta = list(metas)
  285 + itens_da_meta = sorted(list(metas), key = lambda met: met.id)
286 286 alunos = meta_geral.topic.subject.students.all()
287 287 create_excel_file(alunos, itens_da_meta,meta_geral)
  288 + context['goal_file'] = str(meta_geral.slug)+".xls"
288 289  
289 290  
290 291 return context
... ... @@ -324,11 +325,11 @@ def create_excel_file(estudantes,metas,meta):
324 325  
325 326 contador_estudante += 1
326 327  
327   - folder_path = join(settings.BASE_DIR, 'bulletin\\localfiles')
  328 + folder_path = join(settings.BASE_DIR, 'bulletin\\static\\xls')
328 329 #check if the folder already exists
329 330 if not os.path.isdir(folder_path):
330 331 os.makedirs(folder_path)
331   - workbook.save(settings.BASE_DIR+"\\bulletin\\localfiles\"+str(meta.slug)+".xls")
  332 + workbook.save(settings.BASE_DIR+"\\bulletin\\static\\xls\"+str(meta.slug)+".xls")
332 333  
333 334  
334 335  
... ...