回答編集履歴

3

修正

2020/05/21 11:05

投稿

ForestSeo
ForestSeo

スコア2720

test CHANGED
@@ -44,7 +44,9 @@
44
44
 
45
45
  {% endif %}
46
46
 
47
- ```'これでいいのでは?
47
+ ```これでいいのでは?
48
+
49
+
48
50
 
49
51
  要は、userがログインユーザーで、postがdetailのもののテーブルが、あるかないかが分かればいいんですよね。てことは
50
52
 

2

修正

2020/05/21 11:05

投稿

ForestSeo
ForestSeo

スコア2720

test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  context = super().get_context_data(**kwargs)
22
22
 
23
- context['check'] = Like.objects.filter(user=self.request.user, post=self.kwargs.get('パラメータ')).exists()
23
+ context['check'] = Like.objects.filter(user=self.request.user, post=self.kwargs.get('pk')).exists()
24
24
 
25
25
  return context
26
26
 
@@ -44,20 +44,10 @@
44
44
 
45
45
  {% endif %}
46
46
 
47
- ```'パラメータ'に
47
+ ```'これでいいのでは?
48
-
49
- path(detail/<・:~>/, views.PostDetailView.as_view())
50
-
51
- の~を入れてください。
52
-
53
-
54
48
 
55
49
  要は、userがログインユーザーで、postがdetailのもののテーブルが、あるかないかが分かればいいんですよね。てことは
56
50
 
57
51
  Like.objects.filter(user='ログインユーザー', post='投稿').exists()
58
52
 
59
53
  でTrueかFalseが返ります。
60
-
61
-
62
-
63
- できればurls.pyが見たい...

1

修正

2020/05/21 11:05

投稿

ForestSeo
ForestSeo

スコア2720

test CHANGED
@@ -57,3 +57,7 @@
57
57
  Like.objects.filter(user='ログインユーザー', post='投稿').exists()
58
58
 
59
59
  でTrueかFalseが返ります。
60
+
61
+
62
+
63
+ できればurls.pyが見たい...