質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,3 +9,119 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
駄文で申し訳ありませんが、どなたかご回答のほどよろしくお願い致します。
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
---
|
16
|
+
|
17
|
+
**追記**
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
大変失礼致しました。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
views.py
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
# -*- coding:utf-8 -*-
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
from shop.models import Product
|
34
|
+
|
35
|
+
from django.shortcuts import render
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
productList = Product.object.all()
|
40
|
+
|
41
|
+
accessCount = 0;
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
def viewProductList(request):
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
accessCount += 1
|
50
|
+
|
51
|
+
return render(request, "viewProductList.html", productList)
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
viewProductList.html
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
<html>
|
68
|
+
|
69
|
+
<head>
|
70
|
+
|
71
|
+
<title>Product List Page</title>
|
72
|
+
|
73
|
+
</head>
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<body>
|
78
|
+
|
79
|
+
{% for d in data %}
|
80
|
+
|
81
|
+
<h1>{{ d.name }}</h1>
|
82
|
+
|
83
|
+
<h1>{{ d.detailText }}</h1>
|
84
|
+
|
85
|
+
{% endfor %}
|
86
|
+
|
87
|
+
</body>
|
88
|
+
|
89
|
+
</html>
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
models.py
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
# -*- coding:utf-8 -*-
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
from django.db import models
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
class Product(models.Model):
|
108
|
+
|
109
|
+
name = models.CharField(max_length=255)
|
110
|
+
|
111
|
+
detailText = models.CharField(max_length=1000)
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
```
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
上記がコードになります。
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
ご指摘等があれば、何卒よろしくお願い致します。
|