diff --git a/DjangoBlog/settings.py b/DjangoBlog/settings.py
index a6c930f..d0eb072 100644
--- a/DjangoBlog/settings.py
+++ b/DjangoBlog/settings.py
@@ -124,3 +124,6 @@ STATIC_URL = '/static/'
STATICFILES = os.path.join(BASE_DIR, 'static')
AUTH_USER_MODEL = 'accounts.BlogUser'
+
+TIME_FORMAT = '%Y年%n月%j日'
+DATE_TIME_FORMAT = '%Y年%n月%j日'
diff --git a/README.md b/README.md
index 62e6aaa..c91cb24 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,3 @@
#DjangoBlog
+
+基于`python3.5`和`Django1.9`的博客。
\ No newline at end of file
diff --git a/blog/templatetags/blog_tags.py b/blog/templatetags/blog_tags.py
new file mode 100644
index 0000000..699c54a
--- /dev/null
+++ b/blog/templatetags/blog_tags.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+
+"""
+@version: ??
+@author: liangliangyy
+@license: MIT Licence
+@contact: liangliangyy@gmail.com
+@site: https://www.lylinux.org/
+@software: PyCharm
+@file: blog_tags.py
+@time: 2016/11/2 下午11:10
+"""
+
+from django import template
+from django.conf import settings
+import datetime
+
+register = template.Library()
+
+
+@register.simple_tag
+def timeformat(data):
+ try:
+
+ print(data.strftime(settings.TIME_FORMAT))
+ return "ddd"
+ except:
+ return "111"
diff --git a/comments/templatetags/comments_tags.py b/comments/templatetags/comments_tags.py
index 66812ca..9a3317d 100644
--- a/comments/templatetags/comments_tags.py
+++ b/comments/templatetags/comments_tags.py
@@ -23,6 +23,5 @@ register = template.Library()
@register.simple_tag(name='get_comment_count')
def GetCommentCount(parser, token):
- #pkid = token
- #comments = Comment.objects
- return 'wergwergwergwerger'
+ commentcount = Comment.objects.filter(article__author_id=token).count()
+ return "0" if commentcount == 0 else str(commentcount) + " comments"
diff --git a/templates/index.html b/templates/index.html
index 5f39832..4f242b7 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -23,24 +23,19 @@
{{ article.author.username }}
-
-
+ {% load comments_tags %}
+
- {% load comments_tags %}
- {% get_comment_count for article.pk as num_comments %}
+
- {{ num_comments }}
- Responsive web design offers us a way forward, finally allowing us to design for the
- ebb
- and
- flow of things. There are many variations of passages of Lorem Ipsum available, but
- the
- majority have suffered alteration in some form, by injected humour, or randomised
- words
- which don’t look even slightly.
+ {% load blog_tags %}
+ {% timeformat article.created_time %}
+ {{ article.body }}
+
@@ -54,7 +49,7 @@
-
+ {% comment %}
-
+ {% endcomment %}