jsajaxfileuploader

Trying to export data from database to excel in django

泪湿孤枕 提交于 2021-02-11 17:01:15
问题 views.py def export(request): print('start') ourid = request.POST.getlist("terid") queryset = Case_Info.objects.filter(id__in=list(map(int, ourid))) Case_Detail = Case_Info_Resource() print(ourid) dataset = Case_Detail.export(queryset) # error in this line response = HttpResponse( dataset.xls, content_type='application/vnd.ms-excel') response['Content-Disposition'] = 'attachment; filename="persons.xls"' print('end') return response Ajax Script $(document).ready(function () { $('#Download')