Adjustable Forloop Range - HTML

74 views Asked by At

I have an html file in my django templates that contains a forloop. I need to to have a range on the forloop that basically says the forloop will only loop through the first 10 attributes. The complication arrises when I need the range to be adujstable. I need something like a number input that keeps a varaible and then only loops through that many attributes in the forloop. I have been on it for a few days and havent made too much progress. I have worked with simple forloop ranges but havent found a way to make them adjustable. This is the forloop I have been working with.

{% for post in filter.qs %}
    {% if post.image %}
        <img class="pdf_field_img" src="{{ post.image.url }}"/>
    {% else %}
    {% endif %}

    <div class="title">Morgan Hall</div>  <div class="inspection_num">Inspection #</div>  <div 
class="inspect_num">{{ post.count_building }}</div>
{% endfor %}
0

There are 0 answers