質問編集履歴

4

不要部分の削除

2017/02/13 06:35

投稿

PYPP
PYPP

スコア51

test CHANGED
File without changes
test CHANGED
@@ -23,87 +23,3 @@
23
23
  <link rel="stylesheet" type="text/css" href="static/css/blog.css">
24
24
 
25
25
  ```
26
-
27
- base.htmlを継承させたいファイルの1つで、継承が**__できている__**ファイルになります。
28
-
29
- post_list.html
30
-
31
- ```
32
-
33
- {% extends 'posts/base.html' %}
34
-
35
-
36
-
37
- {% block content %}
38
-
39
- {% for post in posts %}
40
-
41
- <div class="post">
42
-
43
- <div class="date">
44
-
45
- <!-- {{ post.published_date }} -->
46
-
47
- {{ post.created_date }}
48
-
49
- </div>
50
-
51
- <h1><a href="/post/{{ post.id }}/">{{ post.title }}</a></h1>
52
-
53
- <p>{{ post.text|linebreaks }}</p>
54
-
55
- </div>
56
-
57
- {% endfor %}
58
-
59
- {% endblock %}
60
-
61
- ```
62
-
63
- base.htmlを継承させたいファイルの1つで、継承が**__できていない__**ファイルになります。
64
-
65
- post_detail.html
66
-
67
- ```
68
-
69
- {% extends 'posts/base.html' %}
70
-
71
-
72
-
73
-
74
-
75
- {% block content %}
76
-
77
- <div="post">
78
-
79
-
80
-
81
- {% if post.published_date %}
82
-
83
- <div class="date">
84
-
85
- {{ post.published_date }}
86
-
87
- </div>
88
-
89
- {% endif %}
90
-
91
-
92
-
93
- {% if user.is_authenticated %}
94
-
95
- <input type="button" value="編集" onClick="location.href='/post/{{ post.id }}/edit';">
96
-
97
- {% endif %}
98
-
99
-
100
-
101
- <h1>{{ post.title }}</h1>
102
-
103
- <p>{{ post.text|linebreaks }}</p>
104
-
105
- </div>
106
-
107
- {% endblock %}
108
-
109
- ```

3

加筆修正

2017/02/13 06:35

投稿

PYPP
PYPP

スコア51

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,9 @@
6
6
 
7
7
  ###発生している問題・エラーメッセージ
8
8
 
9
- base.htmlに加えて、他のhtmlファイルでtemplatesファイルを構成しています。そこで、他のファイルはextendsによりbase.htmlを継承しようとしています。しかし、base.htmlを継承されいるもの、cssファイル反映されていません
9
+ base.htmlに加えて、他のhtmlファイルでtemplatesファイルを構成しています。そこで、他のファイルはextendsによりbase.htmlを継承しようとしています。しかし、post_detail.html下記ようなエラーしまいました
10
+
11
+ ![イメージ説明](60b5693d64a4a9668446f19a89fe1438.png)
10
12
 
11
13
 
12
14
 

2

加筆修正

2017/02/12 14:41

投稿

PYPP
PYPP

スコア51

test CHANGED
File without changes
test CHANGED
@@ -12,17 +12,23 @@
12
12
 
13
13
  ###ソースコード
14
14
 
15
+
16
+
17
+ base.html(抜粋)
18
+
19
+ ```
20
+
21
+ <link rel="stylesheet" type="text/css" href="static/css/blog.css">
22
+
23
+ ```
24
+
15
- base.htmlを継承させたいファイルの1つです。
25
+ base.htmlを継承させたいファイルの1つで、継承が**__できている__**ファイルになります。
16
26
 
17
27
  post_list.html
18
28
 
19
29
  ```
20
30
 
21
31
  {% extends 'posts/base.html' %}
22
-
23
- <!-- {% load staticfiles %} -->
24
-
25
-
26
32
 
27
33
 
28
34
 
@@ -48,12 +54,54 @@
48
54
 
49
55
  {% endfor %}
50
56
 
51
- {% endblock content %}
57
+ {% endblock %}
52
58
 
53
59
  ```
54
60
 
61
+ base.htmlを継承させたいファイルの1つで、継承が**__できていない__**ファイルになります。
62
+
63
+ post_detail.html
64
+
65
+ ```
66
+
67
+ {% extends 'posts/base.html' %}
55
68
 
56
69
 
57
- ###試したこと
58
70
 
71
+
72
+
73
+ {% block content %}
74
+
75
+ <div="post">
76
+
77
+
78
+
79
+ {% if post.published_date %}
80
+
81
+ <div class="date">
82
+
83
+ {{ post.published_date }}
84
+
85
+ </div>
86
+
87
+ {% endif %}
88
+
89
+
90
+
91
+ {% if user.is_authenticated %}
92
+
93
+ <input type="button" value="編集" onClick="location.href='/post/{{ post.id }}/edit';">
94
+
95
+ {% endif %}
96
+
97
+
98
+
59
- <!-- {% load staticfiles %} -->を入れてみたもののダメでした。
99
+ <h1>{{ post.title }}</h1>
100
+
101
+ <p>{{ post.text|linebreaks }}</p>
102
+
103
+ </div>
104
+
105
+ {% endblock %}
106
+
107
+ ```

1

誤字の修正

2017/02/12 13:44

投稿

PYPP
PYPP

スコア51

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  ###発生している問題・エラーメッセージ
8
8
 
9
- エラーではないのですが、base.htmlに加えて、他のhtmlファイルでtemplatesファイルを構成しています。そこで、他のファイルはextendsをしてbase.htmlを継承しようとしています。しかし、base.htmlを継承されているものの、cssファイルが反映されていません。
9
+ base.htmlに加えて、他のhtmlファイルでtemplatesファイルを構成しています。そこで、他のファイルはextendsによりbase.htmlを継承しようとしています。しかし、base.htmlを継承されているものの、cssファイルが反映されていません。
10
10
 
11
11
 
12
12