Пример #1
0
def export_issue_result(request, project_id):
    response = HttpResponse(content_type='application/vnd.ms-excel')
    response['Content-Disposition'] = 'attachment;filename=' + str(
        project_id) + '.xls'
    output = BytesIO()
    wb = IssueService.issue_excel_file(project_id, request.user.id)
    wb.save(output)
    output.seek(0)
    response.write(output.getvalue())
    return response
Пример #2
0
 def get(self, request, *args, **kwargs):
     project_id = self.kwargs.get('project_id', 0)
     issue_list = self.get_queryset()
     return_result = HttpResponse(content_type='application/vnd.ms-excel')
     return_result['Content-Disposition'] = 'attachment;filename=' + str(
         project_id) + '.xls'
     output = BytesIO()
     wb = IssueService.issue_excel_file(issue_list, self.request.user.id)
     wb.save(output)
     output.seek(0)
     return_result.write(output.getvalue())
     return return_result