Django template for loop and display first X matches

后端 未结 3 590
忘了有多久
忘了有多久 2021-01-21 02:59

Not sure exactly how to phrase my problem but I essentially want to loop through a list and show the first 4 matches only.

{% for reward_type in reward_types %}         


        
3条回答
  •  不要未来只要你来
    2021-01-21 03:15

    Use your view function to prepare your list before passing it to the template.

    Django template isn't intended for complex matching like this.

    Exactly as discussed ;-)

提交回复
热议问题