回答編集履歴
7
修正
test
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
def post(self, request):
|
28
28
|
|
29
|
-
return redirect('
|
29
|
+
return redirect(reverse_lazy('like', kwags={'food':request.POST['food']}))
|
30
30
|
|
31
31
|
|
32
32
|
|
6
修正
test
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
initial = super().get_initial()
|
46
46
|
|
47
|
-
initial['like_food'] = self.kwargs
|
47
|
+
initial['like_food'] = self.kwargs.get('food')
|
48
48
|
|
49
49
|
return initial
|
50
50
|
|
5
修正
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# urls.py
|
6
6
|
|
7
|
-
path('like/<str:food>', views.LikeView.as_view(), name='like'),
|
7
|
+
path('like/<str:food>/', views.LikeView.as_view(), name='like'),
|
8
8
|
|
9
9
|
```urlで、記入した好きな食べ物の名前を渡し、
|
10
10
|
|
4
編集
test
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
def post(self, request):
|
28
28
|
|
29
|
-
return redirect('/like
|
29
|
+
return redirect('/like/' + request.POST['food'])
|
30
30
|
|
31
31
|
|
32
32
|
|
3
編集
test
CHANGED
@@ -18,11 +18,15 @@
|
|
18
18
|
|
19
19
|
form_class = FoodForm
|
20
20
|
|
21
|
-
success_url = reverse_lazy('samples:like', kwargs={'food':self.request.POST['food']})
|
22
|
-
|
23
21
|
def form_valid(self, form):
|
24
22
|
|
25
23
|
return super().form_valid(form)
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
def post(self, request):
|
28
|
+
|
29
|
+
return redirect('/like_food' + request.POST['food'])
|
26
30
|
|
27
31
|
|
28
32
|
|
2
編集
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
form_class = FoodForm
|
20
20
|
|
21
|
-
success_url = reverse_lazy('samples:like', kwargs={'
|
21
|
+
success_url = reverse_lazy('samples:like', kwargs={'food':self.request.POST['food']})
|
22
22
|
|
23
23
|
def form_valid(self, form):
|
24
24
|
|
1
編集
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
form_class = FoodForm
|
20
20
|
|
21
|
-
success_url = reverse_lazy('samples:like', kwargs={'
|
21
|
+
success_url = reverse_lazy('samples:like', kwargs={'like_food':self.request.POST['like_food']})
|
22
22
|
|
23
23
|
def form_valid(self, form):
|
24
24
|
|