質問編集履歴

2

検討はずれの質問だったのでソースコードなど削除。

2017/02/09 05:01

投稿

PYPP
PYPP

スコア51

test CHANGED
File without changes
test CHANGED
@@ -7,81 +7,3 @@
7
7
  ###発生している問題・エラーメッセージ
8
8
 
9
9
  発生している問題としては、フォームから投稿してadminには反映されるものの、トップページには新規投稿が反映されないことです。
10
-
11
- ①投稿前のadminページ
12
-
13
- ![イメージ説明](8cce6ec9fe85da327355dcae5ce7d8af.png)
14
-
15
- ②投稿画面
16
-
17
- ![イメージ説明](d038720ae6d25c352b4e00f82b674673.png)
18
-
19
- ③投稿後のadminページ
20
-
21
- ![イメージ説明](a2d4eeca01eaacb24d89044f76ed8b28.png)
22
-
23
- ④投稿後のトップページ
24
-
25
- ![イメージ説明](b5b7ffc06a95e90acf7671d3d1c4f7db.png)
26
-
27
- ###該当のソースコード
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
- </div>
48
-
49
- <!-- <h1><a href="(% url 'posts.views.post_detail' pk=post.pk %)">{{ post.title }}</a></h1> -->
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 content %}
60
-
61
- ```
62
-
63
- views.py(抜粋)
64
-
65
- ```
66
-
67
- from django.shortcuts import render, get_object_or_404, redirect
68
-
69
- from django.utils import timezone
70
-
71
- from .models import Post
72
-
73
- from .forms import PostForm
74
-
75
-
76
-
77
-
78
-
79
- # Create your views here.
80
-
81
- def post_list(request):
82
-
83
- posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
84
-
85
- return render(request, 'posts/post_list.html', {'posts': posts})
86
-
87
- ```

1

加筆

2017/02/09 05:00

投稿

PYPP
PYPP

スコア51

test CHANGED
File without changes
test CHANGED
@@ -19,6 +19,10 @@
19
19
  ③投稿後のadminページ
20
20
 
21
21
  ![イメージ説明](a2d4eeca01eaacb24d89044f76ed8b28.png)
22
+
23
+ ④投稿後のトップページ
24
+
25
+ ![イメージ説明](b5b7ffc06a95e90acf7671d3d1c4f7db.png)
22
26
 
23
27
  ###該当のソースコード
24
28