File tree Expand file tree Collapse file tree 4 files changed +10
-4
lines changed Expand file tree Collapse file tree 4 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def __str__(self):
24
24
return self .title
25
25
26
26
class Meta :
27
- ordering = ['last_modified_time' ]
27
+ ordering = ['- last_modified_time' ]
28
28
29
29
30
30
class Category (models .Model ):
Original file line number Diff line number Diff line change @@ -538,7 +538,7 @@ a.backToTop:hover {
538
538
width : 14px ;
539
539
height : 13px ;
540
540
margin-right : 7px ;
541
- background : url (img/date.png) no-repeat;
541
+ background : url(.. / img/date.png) no-repeat;
542
542
}
543
543
544
544
Original file line number Diff line number Diff line change 4
4
< div id ="category-title ">
5
5
< ul >
6
6
< li > 分类:</ li >
7
- < li class ="cat-item "> < a href =""> 111</ a > </ li >
7
+ {% for category in category_list %}
8
+ < li class ="cat-item "> < a href =""> {{ category.name }}</ a > </ li >
9
+ {% endfor %}
8
10
</ ul >
9
11
</ div >
10
12
</ div >
@@ -24,7 +26,7 @@ <h1 class="title"><a href="">{{ article.title }}</a></h1>
24
26
< div class ="post-ft ">
25
27
< a href ="" class ="more "> 阅读全文> > </ a >
26
28
< i class ="icon-date "> </ i >
27
- < span class ="date "> {{ article.last_modified_time }}</ span >
29
+ < span class ="date "> {{ article.last_modified_time|date:"Y年n月d日" }}</ span >
28
30
</ div >
29
31
</ div >
30
32
{% endfor %}
Original file line number Diff line number Diff line change @@ -14,3 +14,7 @@ def get_queryset(self):
14
14
for article in article_list :
15
15
article .body = markdown2 .markdown (article .body , )
16
16
return article_list
17
+
18
+ def get_context_data (self , ** kwargs ):
19
+ kwargs ['category_list' ] = Category .objects .all ().order_by ('name' )
20
+ return super (IndexView , self ).get_context_data (** kwargs )
You can’t perform that action at this time.
0 commit comments