📜  django jinja 子集字符串 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:19.143000             🧑  作者: Mango

代码示例1
{{ model.field|truncatewords:30 }}
# Example below returns just the first 30 words of the text_summary column 
# (for each line/book in the books table)
    {% for book in books.all %}
  • {{ book.text_summary|truncatewords:30 }}
  • {% endfor %}