0
私はC#でコードを作成していましたが、これは私がこのコードは明らかに機能していないジャンゴDjango - Djangoテンプレートのオブジェクト数を制限する
に{% with 0 as starting_index %}
{% for comment in comments %}
<!--set a variable to limit the amount of comment on a page-->
{% with forloop.counter as index %}
{% if index < 3 %}
<div class="comment_body">
<div class="content_block">
<p>{{comments[index]}}</p>
</div>
</div>
{% endif %}
{% endwith %}
{% endfor %}
{% endwith %}
を試みた方法です
int start_index = 4;
List<int> list = { ... }
for(int i = start_index;i < 10;i++){
list[i].dosomething();
}
:私のような何かをするためにはPythonを使用したいです。誰も私にこの問題を手伝うことができますか? ありがとうございます!
私はテンプレートでこれを行うのではなく、ビューでこれを行う方がよいと思います。それは理にかなっていますか? – rajkris
@ RajKrisあなたは正しいです、私は笑いを使用することができます忘れて、 –
それは助けて欲しい!乾杯。 – rajkris