【发布时间】:2014-08-08 16:26:45
【问题描述】:
假设我的 django rest 框架应用正在为这个 url 返回这个 json(其中 4 是模型的 pk):http:mydomain.com/model_number/4/?format=json
[
{
"id": 96,
"title": "title 1",
"picture": "static/uploads/pic1.jpg"
},
{
"id": 97,
"title": "title 2",
"picture": "static/uploads/pic2.jpg"
},
{
"id": 98,
"title": "title 3",
"picture": "static/uploads/pic3.jpg"
}
]
我想创建和下载一个包含上述内容的 json 文件(由 django rest 框架生成)的 zip,以及一个包含 pic1、pic2 和 pic3 的文件夹。
我可以下载包含这些图片的文件夹的 zip,但我不知道如何包含 json 文件。
不知道是不是和parsers有关:
任何帮助将不胜感激
【问题讨论】:
标签: python json django django-rest-framework