I want to display in a html as many tables as there are loops in a tournament object.
I need to iterate by value in field loop_count of Tournament model (the numbers themselves in the list are not needed). I didn't find a way on the Internet, so I came up with it myself. With property, is this the best way for do it?
Tournament model:
class Tournament(models.Model):
    name = models.CharField("Title",max_length=50,unique=True)
    loop_count = models.PositiveSmallIntegerField("Count of loop")
    @property
    def loop_count_list(self):
        return range(self.loop_count)
Html:
{% for loop in tournament.loop_count_list %}
<div class="home-champ"...>
{% endfor %>
And if I need the numbers themselves in the list, I can do the following: (i know about forloop.counter)
Html:
{% for loop in tournament.loop_count_list %}
<b>Index: {{ loop }}</b>
<div class="home-champ"...>
{% endfor %>
 
    