回答編集履歴
3
些細
answer
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
response = HttpResponse(zip_file, content_type='application/zip')
|
3
3
|
```
|
4
4
|
|
5
|
-
こう書いたら第1引数を文字列化(つまり`str(zip_file)`して
|
5
|
+
こう書いたら第1引数を文字列化(つまり`str(zip_file)`)して、バイト列にしたデータをレスポンスにするので、`<zipfile.ZipFile filename='ファイルパス' mode='r'>`みたいなデータ(テキストファイル)が返っているはずですよ。
|
6
6
|
|
7
7
|
参考
|
8
8
|
[https://github.com/django/django/blob/stable/3.1.x/django/http/response.py#L328](https://github.com/django/django/blob/stable/3.1.x/django/http/response.py#L328)
|
2
追記
answer
CHANGED
@@ -5,4 +5,5 @@
|
|
5
5
|
こう書いたら第1引数を文字列化(つまり`str(zip_file)`して)、バイト列にしたデータをレスポンスにするので、`<zipfile.ZipFile filename='ファイルパス' mode='r'>`みたいなデータ(テキストファイル)が返っているはずですよ。
|
6
6
|
|
7
7
|
参考
|
8
|
+
[https://github.com/django/django/blob/stable/3.1.x/django/http/response.py#L328](https://github.com/django/django/blob/stable/3.1.x/django/http/response.py#L328)
|
8
9
|
[https://github.com/django/django/blob/stable/3.1.x/django/http/response.py#L243](https://github.com/django/django/blob/stable/3.1.x/django/http/response.py#L243)
|
1
追記
answer
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
response = HttpResponse(zip_file, content_type='application/zip')
|
3
3
|
```
|
4
4
|
|
5
|
-
こう書いたら第1引数を文字列化(つまり`str(zip_file)`して)、バイト列にしたデータをレスポンスにするので、`<zipfile.ZipFile filename='ファイルパス' mode='r'>`みたいなデータが返っているはずですよ。
|
5
|
+
こう書いたら第1引数を文字列化(つまり`str(zip_file)`して)、バイト列にしたデータをレスポンスにするので、`<zipfile.ZipFile filename='ファイルパス' mode='r'>`みたいなデータ(テキストファイル)が返っているはずですよ。
|
6
6
|
|
7
7
|
参考
|
8
8
|
[https://github.com/django/django/blob/stable/3.1.x/django/http/response.py#L243](https://github.com/django/django/blob/stable/3.1.x/django/http/response.py#L243)
|