master
车亮亮 9 years ago
parent e4c8a6a13e
commit 551c4c6e81

@ -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日'

@ -1 +1,3 @@
#DjangoBlog
基于`python3.5`和`Django1.9`的博客。

@ -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"

@ -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"

@ -23,24 +23,19 @@
</span>
<span class="post-author"><a href="#">{{ article.author.username }}</a></span>
<span class="comments-link"><a href="#">4 Comments</a></span>
{% load comments_tags %}
<span class="comments-link"><a
href="#">{% get_comment_count for article.pk %}</a></span>
</div>
</header>
<div class="entry-content clearfix">
{% load comments_tags %}
{% get_comment_count for article.pk as num_comments %}
<p>
{{ 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 dont look even slightly.</p>
{% load blog_tags %}
{% timeformat article.created_time %}
{{ article.body }}
</p>
<div class="read-more cl-effect-14">
<a href="#" class="more-link">Continue reading <span class="meta-nav"></span></a>
</div>
@ -54,7 +49,7 @@
<article class="post post-2">
{% comment %}<article class="post post-2">
<header class="entry-header">
<h1 class="entry-title">
<a href="single.html">Adaptive Vs. Responsive Layouts And Optimal Text Readability</a>
@ -136,7 +131,7 @@
<a href="#" class="more-link">Continue reading <span class="meta-nav"></span></a>
</div>
</div>
</article>
</article>{% endcomment %}
</main>
<aside class="col-md-4">
<div class="widget widget-recent-posts">

Loading…
Cancel
Save