ページレイアウトの
Django Template 内で
丁度いいのが
StackOverFlowで、
Django template tag to truncate text - Stack Overflow
Django 1.4 からtruncatechars
と...
に
<a href="{{ next.get_absolute_url }}">{{ next|truncatechars:30 }} ></a>
ちなみに、
の
truncatechars
以外に、
truncatewords
、
truncatechars_html
、
truncatewords_html
filterも
違いは、truncatechars
はtruncatewords
は
truncatechars_html
と、truncatewords_html
は
省略してくれると
以上です。
コメント