请帮我解决我的问题。
如果这听起来很棒,我很抱歉,因为我真的很喜欢。某个数据库中有文件(jpg,docs),我如何在数据库中选择这些文件,将它们保存在zip文件中,然后以HttpResponse或类似的方式发送到浏览器:
response = HttpResponse(mimetype='application/zip')
response['Content-Disposition'] = 'filename=group.zip'
困扰我的部分是从数据库中获取文件时,谷歌似乎没有帮助。
我所拥有的一些相关代码是:
temp = request.POST.getlist('cbox') #cbox is the field in form
tempx = models.FileTable.objects.filter(pk__in = temp)
我不再知道该怎么做了。提前致谢! :P