質問編集履歴

2

不要部分の削除

2017/02/11 17:40

投稿

PYPP
PYPP

スコア51

test CHANGED
File without changes
test CHANGED
@@ -3,10 +3,6 @@
3
3
  Python(Django)のチュートリアルでブログの作成に挑戦しました。ここで使ったブログを土台に、自分のブログを作りたいと思っています。そこで、投稿した内容を日付順に並べたいのですが古い順に出てしまいます。
4
4
 
5
5
 
6
-
7
- ###発生している問題・エラーメッセージ
8
-
9
- ![イメージ説明](e78c41b03fc41e1684c59ff02bd9a1dd.png)
10
6
 
11
7
 
12
8
 
@@ -18,30 +14,8 @@
18
14
 
19
15
  def post_list(request):
20
16
 
21
- # posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
22
-
23
17
  posts = Post.objects.filter(created_date__lte=timezone.now()).order_by('created_date')
24
18
 
25
19
  return render(request, 'posts/post_list.html', {'posts': posts})
26
20
 
27
21
  ```
28
-
29
-
30
-
31
- ###試したこと
32
-
33
- forms.pyを①に変えてみましたがダメでした。
34
-
35
- ```ここに言語を入力
36
-
37
- class PostForm(forms.ModelForm):
38
-
39
- class Meta:
40
-
41
- model = Post
42
-
43
- # fields = ('created_date', 'title', 'text',) //①
44
-
45
- fields = ('title', 'text',)//②
46
-
47
- ```

1

タイトルの修正

2017/02/11 17:40

投稿

PYPP
PYPP

スコア51

test CHANGED
@@ -1 +1 @@
1
- Postオブジェクトfilter設定について
1
+ 投稿並び順について
test CHANGED
File without changes