質問編集履歴
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -74,4 +74,6 @@
|
|
74
74
|
|
75
75
|
```if request.FILE['file']```
|
76
76
|
|
77
|
+
だとエラーがでたため、
|
78
|
+
|
77
|
-
|
79
|
+
ファイル取得を任意にする際どうすべきかがわかりません。
|
1
models.pyとsetting.pyの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
###不明:保存する処理###
|
36
36
|
|
37
|
-
|
37
|
+
FileModel.objects.create(title=title,file=###不明###)
|
38
38
|
|
39
39
|
return render(request...省略
|
40
40
|
|
@@ -44,7 +44,23 @@
|
|
44
44
|
|
45
45
|
return render(request...省略
|
46
46
|
|
47
|
+
|
48
|
+
|
47
|
-
|
49
|
+
#models.py
|
50
|
+
|
51
|
+
class FileModel(models.Model):
|
52
|
+
|
53
|
+
title = models.CharField(max_length=100)
|
54
|
+
|
55
|
+
file = models.ImageField(upload_to='',null=True, blank=True)
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
#setting.py
|
60
|
+
|
61
|
+
MEDIA_ROOT = os.path.join(BASE_DIR,'image')
|
62
|
+
|
63
|
+
MEDIA_URL = '/image/'
|
48
64
|
|
49
65
|
```
|
50
66
|
|