I have a model
class tournaments(models.Model): # .... total_rounds = models.IntegerField(max_length=11, blank=True, null=True) # .... def get_total_rounds_count(self): return self.total_rounds
views.py:
def tourney_view(request, offset): # ..... if (offset): selected_tournament = tournaments.objects.get(id=offset) return render_to_response('tournament.html', {'tournament': selected_tournament})
In 'tournament.html' template i trying to loop over total_rounds:
{% for q in tournament.get_total_rounds_count%} {% endfor %}
And got error: 'long' object is not iterable Why? My field is IntegerField, and i am simply trying to loop over integer values, but get "not iterable"