{#

过滤器的基本使用

#} {#

位置的绝对值为[未使用过滤器]:{{ postion}}

#} {#

位置的绝对值为[使用过滤器]:{{ postion|abs}}

#} {#
#} {#

default过滤器的使用

#} {#

个性签名1[使用过滤器]:{{ signature|default('此人很懒,暂无签名',boolean=True)}}

#} {#

个性签名2[使用or]:{{ signature or '此人很懒,没有任何说明'}}

#}

常用的过滤器使用

个性签名3:{{ signature }}

{% autoescape off %}

个性签名4:{{ signature | escape}}

{% endautoescape %} {#

个性签名5:{{ signature | safe}}

#}

第一个人:{{ persons | first}}

最后一个人:{{ persons | last}}

总人数:{{ persons | length}}

{% if gender|int==1 %}

性别:男

{% else %}

性别:女

{% endif %}

章节内容old:{{ article }}

章节内容new:{{ article |replace('她妈的','TMD') }}

新闻内容old:{{ news}}

新闻内容new:{{ news | truncate(length=10)}}

签名显示去掉其中的html标签:{{ signature | striptags}}

使用自定义过滤器

新闻内容old:{{ news }}

新闻内容new:{{ news| cut }}

使用自定义过滤器 处理时间

新闻创建时间old:{{ create_time }}

新闻间隔现在的时间new:{{ create_time |handle_time }}