質問編集履歴
1
modelを追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -118,6 +118,94 @@
|
|
118
118
|
|
119
119
|
```
|
120
120
|
|
121
|
+
```python
|
122
|
+
|
123
|
+
from django.urls import path
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
from . import views
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
app_name = 'bento'
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
urlpatterns = [
|
138
|
+
|
139
|
+
path('thanks/', views.Thanks.as_view(), name='thanks'),
|
140
|
+
|
141
|
+
path('create/', views.Create.as_view(), name='create'),
|
142
|
+
|
143
|
+
path('list/', views.ShopList.as_view(), name='list'),
|
144
|
+
|
145
|
+
path('order/<int:pk>/', views.Order.as_view(), name='order'),
|
146
|
+
|
147
|
+
path('result/', views.OrderResult.as_view(), name='order_result'),
|
148
|
+
|
149
|
+
path('order_confirm_detail/<int:pk>/', views.OrderConfirm.as_view(), name='order_confirm'),
|
150
|
+
|
151
|
+
path('testview/', views.testview, name='testview')
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
```
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
```python
|
160
|
+
|
161
|
+
class Register(models.Model):
|
162
|
+
|
163
|
+
"""店舗登録モデル"""
|
164
|
+
|
165
|
+
class Meta:
|
166
|
+
|
167
|
+
db_table = 'shop'
|
168
|
+
|
169
|
+
verbose_name_plural = '店舗登録'
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
name = models.CharField(verbose_name='店舗名', max_length=50) # 店舗名
|
174
|
+
|
175
|
+
email = models.EmailField(max_length=256, unique=True) # メールアドレス
|
176
|
+
|
177
|
+
tel = models.CharField(max_length=14) # 電話番号HPには公開しない
|
178
|
+
|
179
|
+
address = models.TextField(verbose_name='住所', null=True, blank=True)
|
180
|
+
|
181
|
+
text = models.TextField(max_length=256) # 店舗紹介文
|
182
|
+
|
183
|
+
item = models.ImageField(verbose_name='商品画像', upload_to='item_img') # 商品画像
|
184
|
+
|
185
|
+
shop = models.ImageField(verbose_name='店舗画像', upload_to='shop_img') # 店主画像
|
186
|
+
|
187
|
+
delivery1 = models.CharField(verbose_name='受け取り1', max_length=12, null=True, blank=True) # 受取1
|
188
|
+
|
189
|
+
delivery2 = models.CharField(verbose_name='受け取り2', max_length=12, null=True, blank=True) # 受取2
|
190
|
+
|
191
|
+
delivery3 = models.CharField(verbose_name='受け取り3', max_length=12, null=True, blank=True) # 受取3
|
192
|
+
|
193
|
+
price = models.IntegerField(default=750, null=True, blank=True) # 価格将来的に利用
|
194
|
+
|
195
|
+
created = models.DateTimeField(auto_now_add=True) # 登録日
|
196
|
+
|
197
|
+
saved = models.DateTimeField(auto_now=True) # 更新日
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
def __str__(self):
|
202
|
+
|
203
|
+
return self.name
|
204
|
+
|
205
|
+
```
|
206
|
+
|
207
|
+
|
208
|
+
|
121
209
|
|
122
210
|
|
123
211
|
### 試したこと
|