Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dengmin committed Dec 25, 2012
1 parent cc4ef5f commit 92c82df
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
logpress-tornado
================

使用[tornado][tornado],[jinja2][jinja2],[peewee][peewee]开发的基于markdown写作的博客
使用[tornado][tornado],[jinja2][jinja2],[peewee][peewee]开发的基于markdown写作的博客 [站点][demo]

1. **创建数据库**

Expand Down Expand Up @@ -40,3 +40,4 @@ logpress-tornado
[tornado]:http://www.tornadoweb.org/
[jinja2]:http://jinja.pocoo.org/
[peewee]:http://peewee.readthedocs.org/en/latest/index.html
[demo]:http://blog.szgeist.com
2 changes: 0 additions & 2 deletions handlers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ def post(self):
tag = self.get_argument('tag',None)

category = Category.get(id=int(category_id))
print tag
post = Post.create(title=title,category=category,slug=slug,content=content,tags=tag)

if tag:
print tag
for tag in post.taglist():
Tag.create(name=tag,post=post.id)
self.render('admin/post/add.html')
Expand Down
3 changes: 3 additions & 0 deletions handlers/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def get_archives(self):
def get_calendar_widget(self):
pass

def get_recent_comments(self):
return Comment.select().order_by(Comment.created.desc()).limit(5)

def render(self,template_name,**context):
tpl = '%s/%s'%(self.settings.get('theme_name'),template_name)
return BaseHandler.render(self,tpl,**context)
Expand Down
2 changes: 1 addition & 1 deletion templates/fluid-blue/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h2 class="posttitle"><a href="{{post.url}}" rel="bookmark" title="Permanent Lin
{% endfor %}
{%endif%}
Category: <a href="{{post.category.url}}" title="View all posts in {{post.category.name}}">{{post.category.name}}</a>&nbsp;&nbsp;|&nbsp;
<a href="{{post.url}}#comments">{{post.comment.count()}} Comments</a>
<a href="{{post.url}}#comments">{{post.comments.count()}} Comments</a>
</div>
</div>

Expand Down
8 changes: 7 additions & 1 deletion templates/fluid-blue/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ <h2 class="widgettitle">近期文章</h2>
<li class="widget widget_recent_comments">
<h2 class="widgettitle">最新评论</h2>
<ul id="recentcomments">
<li class="recentcomments"></li>
{%for comment in handler.get_recent_comments()%}
<li class="recentcomments">
<a href="{%if comment.website%}{{comment.website}}{%else%}/{%endif%}" rel="external nofollow" class="url">{{comment.author}}</a>
on
<a href="{{comment.url}}">{{comment.post.title}}</a>
</li>
{% endfor %}
</ul>
</li>
<li><h2>分类目录</h2>
Expand Down

0 comments on commit 92c82df

Please sign in to comment.