How to break “for loop” in Django template

后端 未结 6 1742
甜味超标
甜味超标 2020-12-14 06:13

I have this code

    {% for account in object_list %}
        
        {% for field, value in book.get_fields %}
              {{ field.v         


        
6条回答
  •  时光说笑
    2020-12-14 06:30

    I think you should use slice to achieve your goal

    {% for account in object_list|slice:":1" %}
    

提交回复
热议问题