質問編集履歴
8
ルートのurls.pyを追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
のエラーが表示され、何度見直しても解決することができません。
|
6
6
|
|
7
7
|
一つ上の http://127.0.0.1:8000/lesson/ は関数を使っており正常に表示できています。
|
8
|
+
rootのveiws.pyには include を使っています。
|
8
9
|
|
9
10
|
Googleでいろいろ調べて、urls.py の記載が悪いことはわかりましたが、いろいろ試すも解決することができず困っています。Classでviews.pyを記載したのが初めてなので、何が悪いのか全く分かりません。
|
10
11
|
誰かわかる方がいれば教えていただけると幸いです。
|
@@ -13,8 +14,16 @@
|
|
13
14
|
よろしくお願いします。
|
14
15
|
|
15
16
|
|
16
|
-
urls.py
|
17
|
+
./urls.py
|
17
18
|
```ここに言語を入力
|
19
|
+
urlpatterns = [
|
20
|
+
path('admin/', admin.site.urls),
|
21
|
+
path('lesson/', include('lesson.urls')),
|
22
|
+
path('', include('register.urls')),
|
23
|
+
]
|
24
|
+
```
|
25
|
+
lesson/urls.py
|
26
|
+
```ここに言語を入力
|
18
27
|
from django.urls import path
|
19
28
|
from lesson.views import RecordListView
|
20
29
|
from lesson import views
|
7
同様
title
CHANGED
File without changes
|
body
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
path('record_list/', RecordListView.as_view()),
|
27
27
|
]
|
28
28
|
```
|
29
|
-
|
29
|
+
views.py
|
30
30
|
```ここに言語を入力
|
31
31
|
from django.shortcuts import render
|
32
32
|
from django.views import generic
|
6
スペルの間違いを修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
|
7
7
|
一つ上の http://127.0.0.1:8000/lesson/ は関数を使っており正常に表示できています。
|
8
8
|
|
9
|
-
Googleでいろいろ調べて、urls.py の記載が悪いことはわかりましたが、いろいろ試すも解決することができず困っています。Classで記載したのが初めてなので、何が悪いのか全く分かりません。
|
9
|
+
Googleでいろいろ調べて、urls.py の記載が悪いことはわかりましたが、いろいろ試すも解決することができず困っています。Classでviews.pyを記載したのが初めてなので、何が悪いのか全く分かりません。
|
10
10
|
誰かわかる方がいれば教えていただけると幸いです。
|
11
11
|
|
12
|
-
urls.pyと
|
12
|
+
urls.pyとviews.py(エラーの関数(RecordListView)を定義したところのみ抜粋)を記載しておきます。
|
13
13
|
よろしくお願いします。
|
14
14
|
|
15
15
|
|
5
関数について記載
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
Reverse for '/' not found. '/' is not a valid view function or pattern name.
|
5
5
|
のエラーが表示され、何度見直しても解決することができません。
|
6
6
|
|
7
|
-
一つ上の http://127.0.0.1:8000/lesson/ は正常に表示できています。
|
7
|
+
一つ上の http://127.0.0.1:8000/lesson/ は関数を使っており正常に表示できています。
|
8
8
|
|
9
|
-
Googleでいろいろ調べて、urls.py の記載が悪いことはわかりましたが、いろいろ試すも解決することができず困っています。
|
9
|
+
Googleでいろいろ調べて、urls.py の記載が悪いことはわかりましたが、いろいろ試すも解決することができず困っています。Classで記載したのが初めてなので、何が悪いのか全く分かりません。
|
10
10
|
誰かわかる方がいれば教えていただけると幸いです。
|
11
11
|
|
12
12
|
urls.pyとview.py(エラーの関数(RecordListView)を定義したところのみ抜粋)を記載しておきます。
|
4
RecordListViewのtemplae_nameをlesson/record_list.htmlに戻す
title
CHANGED
File without changes
|
body
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
|
36
36
|
class RecordListView(generic.ListView):
|
37
37
|
model = Record
|
38
|
-
template_name = 'record_list.html'
|
38
|
+
template_name = 'lesson/record_list.html'
|
39
39
|
context_object_name = 'all_record_list'
|
40
40
|
|
41
41
|
def get_queryset(self):
|
3
RecordListViewのtemplae_nameをrecord_list.htmlに変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
|
36
36
|
class RecordListView(generic.ListView):
|
37
37
|
model = Record
|
38
|
-
template_name = '
|
38
|
+
template_name = 'record_list.html'
|
39
39
|
context_object_name = 'all_record_list'
|
40
40
|
|
41
41
|
def get_queryset(self):
|
2
views.pyのfrom部分を追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -28,6 +28,11 @@
|
|
28
28
|
```
|
29
29
|
view.py
|
30
30
|
```ここに言語を入力
|
31
|
+
from django.shortcuts import render
|
32
|
+
from django.views import generic
|
33
|
+
from .models import Record
|
34
|
+
|
35
|
+
|
31
36
|
class RecordListView(generic.ListView):
|
32
37
|
model = Record
|
33
38
|
template_name = 'lesson/record_list.html'
|
1
エラー画像追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -36,4 +36,5 @@
|
|
36
36
|
def get_queryset(self):
|
37
37
|
"""Return the last five published questions."""
|
38
38
|
return Record.objects.order_by('-lesson_date')[:5]
|
39
|
-
```
|
39
|
+
```
|
40
|
+

|