teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

コードの追加

2021/01/12 01:12

投稿

yoshihiro27
yoshihiro27

スコア1

title CHANGED
File without changes
body CHANGED
@@ -57,6 +57,7 @@
57
57
  app_name = 'notes'
58
58
 
59
59
  urlpatterns = [
60
+ path('ar1/',views.note_ar1,name='note_ar1'),
60
61
  path("article/<int:pk>/like/",views.like,name='like'),
61
62
  path("api/like/<int:pk>/",views.api_like,name="api_like"),
62
63
  ```

2

コードの追加

2021/01/12 01:12

投稿

yoshihiro27
yoshihiro27

スコア1

title CHANGED
File without changes
body CHANGED
@@ -71,8 +71,10 @@
71
71
  from django.http.response import JsonResponse
72
72
  from .models import Article
73
73
 
74
+ def note_ar1(request):
75
+ notes = Note.objects.filter(grade="1",sub="11")
76
+ return render(request,'notes/note_ar1.html',{'notes': notes})
74
77
 
75
-
76
78
  def like(request,pk):
77
79
  try:
78
80
  article = Article.objects.get(pk=pk)

1

エラー情報の追加

2021/01/12 01:08

投稿

yoshihiro27
yoshihiro27

スコア1

title CHANGED
File without changes
body CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
  いいね機能を実装中に以下のエラーメッセージが発生しました。
5
+ 開発用サーバーを起動し、テンプレートのページを開いた時にエラーが発生し、テンプレートの<p><a href="{% url 'notes:like' article.pk %}"><span id="like">{{ article.like }}</span>いいね!</a></p>のところでエラーになっていました。
5
6
 
6
7
  ### 発生している問題・エラーメッセージ
7
8