diff --git a/blog/templatetags/blog_tags.py b/blog/templatetags/blog_tags.py index d29e032..b7ff3c5 100644 --- a/blog/templatetags/blog_tags.py +++ b/blog/templatetags/blog_tags.py @@ -148,9 +148,9 @@ def load_sidebar(user, linktype): tags = Tag.objects.all() sidebar_tags = None if tags and len(tags) > 0: - s = list(map(lambda t: (t, t.get_article_count()), tags)) - count = sum(map(lambda t: t[1], s)) - dd = 1 if (count == 0 and not len(tags)) else count / len(tags) + s = [t for t in [(t, t.get_article_count()) for t in tags] if t[1] > 0] + count = sum([t[1] for t in s]) + dd = 1 if (count == 0 or not len(tags)) else count / len(tags) import random sidebar_tags = list(map(lambda x: (x[0], x[1], (x[1] / dd) * increment + 10), s)) random.shuffle(sidebar_tags) diff --git a/templates/blog/article_detail.html b/templates/blog/article_detail.html index f404410..d0bc985 100755 --- a/templates/blog/article_detail.html +++ b/templates/blog/article_detail.html @@ -58,7 +58,8 @@ {% else %}
您还没有登录,请您登录后发表评论。
+ href="{% url "account:login" %}?next={{ request.get_full_path }}" rel="nofollow">登录后发表评论。 + {% load oauth_tags %} {% load_oauth_applications request %} diff --git a/templates/share_layout/base_account.html b/templates/share_layout/base_account.html index 6457260..d7160b5 100644 --- a/templates/share_layout/base_account.html +++ b/templates/share_layout/base_account.html @@ -9,7 +9,7 @@ - +