質問編集履歴

3

ファイル名を追加

2019/02/25 13:21

投稿

kotatsu2
kotatsu2

スコア16

test CHANGED
File without changes
test CHANGED
@@ -18,6 +18,12 @@
18
18
 
19
19
  ```ここに言語を入力
20
20
 
21
+ views.py
22
+
23
+
24
+
25
+
26
+
21
27
  from django.views.generic import TemplateView  ←これを追加
22
28
 
23
29
 
@@ -66,6 +72,14 @@
66
72
 
67
73
  ```ここに言語を入力
68
74
 
75
+ schedule_list.html
76
+
77
+
78
+
79
+
80
+
81
+
82
+
69
83
  <section>
70
84
 
71
85
  <div class="row">

2

エラー表示の追記

2019/02/25 13:21

投稿

kotatsu2
kotatsu2

スコア16

test CHANGED
File without changes
test CHANGED
@@ -192,7 +192,9 @@
192
192
 
193
193
  ``````ここに言語を入力
194
194
 
195
+ path('schedule/', schedule.views.schedule_list, name='schedule_list'),
196
+
195
- module 'schedule.views' has no attribute 'schedule_list'
197
+ AttributeError: module 'schedule.views' has no attribute 'schedule_list'
196
198
 
197
199
  ```
198
200
 

1

テンプレートのタグを追加した

2019/02/25 13:15

投稿

kotatsu2
kotatsu2

スコア16

test CHANGED
File without changes
test CHANGED
@@ -64,6 +64,128 @@
64
64
 
65
65
 
66
66
 
67
+ ```ここに言語を入力
68
+
69
+ <section>
70
+
71
+ <div class="row">
72
+
73
+ <div class="col-lg-12">
74
+
75
+ <div class="page-header">
76
+
77
+ <h4 class="mt-4 mb-5 border-bottom">スケジュール一覧</h4>
78
+
79
+ </div>
80
+
81
+ </div>
82
+
83
+ </div>
84
+
85
+
86
+
87
+ <div class="float-right">
88
+
89
+ <a href="{% url 'schedule_create' %}"><button type="button" class="btn btn-primary">スケジュール新規追加</button></a>
90
+
91
+ </div>
92
+
93
+
94
+
95
+ <div class="table-responsive">
96
+
97
+ <table class="table table-hover">
98
+
99
+ <thead>
100
+
101
+ <tr class="table-active">
102
+
103
+ <th scope="col" width="15%">Name</th>
104
+
105
+ <th scope="col" width="15%">Date</th>
106
+
107
+ <th scope="col" width="25%">Article</th>
108
+
109
+ <th scope="col" width="45%">Content</th>
110
+
111
+ </tr>
112
+
113
+ </thead>
114
+
115
+ <tbody>
116
+
117
+ {% for schedule in schedules %}
118
+
119
+ <tr>
120
+
121
+ <td><a href="{% url 'student_detail_with_schedule' schedule.id %}">{{ schedule.student }}</a></td>
122
+
123
+ <td><a href="{% url 'schedule_detail' schedule.id %}">{{ schedule.date }}</a></td>
124
+
125
+ <td>{{ schedule.article }}</td>
126
+
127
+ <td>{{ schedule.content }}</td>
128
+
129
+ </tr>
130
+
131
+ {% endfor %}
132
+
133
+ </tbody>
134
+
135
+ </table>
136
+
137
+ </div>
138
+
139
+
140
+
141
+ <p>
142
+
143
+ <hr>
144
+
145
+ </p>
146
+
147
+
148
+
149
+ <div class="container-fluid">
150
+
151
+
152
+
153
+ {% if schedules.has_previous %}
154
+
155
+ <a href="?page={{ schedules.previous_page_number }}">&lt;&lt; Previous</a>
156
+
157
+ {% else %}
158
+
159
+ <span>&lt;&lt; Previous</span>
160
+
161
+ {% endif %}
162
+
163
+
164
+
165
+ &nbsp;&nbsp;|&nbsp;{{ schedules.number }}ページ&nbsp;&nbsp;|&nbsp;
166
+
167
+
168
+
169
+ {% if schedules.has_next %}
170
+
171
+ <a href="?page={{ schedules.next_page_number }}">Next &gt;&gt;</a>
172
+
173
+ {% else %}
174
+
175
+ <span>Next &gt;&gt;</span>
176
+
177
+ {% endif %}
178
+
179
+
180
+
181
+
182
+
183
+ </div>
184
+
185
+ </section>
186
+
187
+ ```
188
+
67
189
  しかしこれでサーバーを実行させると
68
190
 
69
191