Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8187923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:43:56+00:00 2026-06-07T02:43:56+00:00

I have a model class tournaments(models.Model): # …. total_rounds = models.IntegerField(max_length=11, blank=True, null=True) #

  • 0
  1. 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
    
  2. 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})
    
  3. 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”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:43:59+00:00Added an answer on June 7, 2026 at 2:43 am

    You can either use this snippet: http://djangosnippets.org/snippets/1357/

    Or define Tournament.get_total_rounds which returns range(get_total_rounds_count)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model: class Example(models.Model): unique_hash = models.CharField(max_length=32,unique=True) content = models.FileField(upload_to='source',blank=True,verbose_name=HTML Content File)
I have a model: class myModels(model.Model): handler = models.ForeignKey(User, blank=True, null=True) The foreign key
I have a model: class MyModel(models.Model): id = models.IntegerField(primary_key=True) recorded_on = models.DateField() precipitation =
I have this model: class Journals(models.Model): jid = models.AutoField(primary_key=True) code = models.CharField(Code, max_length=50) name
I have 2 model: class Sideshow_manager(models.Model): url_id = models.CharField(max_length=250,editable=False,unique=True) title = models.CharField(max_length=250) date =
I have two model: class Questions(models.Model): question = models.TextField(verbose_name='Question') def get_answers(self): query = self.answers.select_related()
I have this model: class Category(models.Model): name = models.CharField() description = models.CharField(blank=True) parent =
I have a model: class Server(models.Model): serverId = models.IntegerField(verbose_name=_(serverId)) name = models.CharField(max_length=200, verbose_name=_(server_name)) ip
I have a model: class Zone(models.Model): name = models.CharField(max_length=128) users = models.ManyToManyField(User, related_name='zones', null=True,
Actually have this model: class MusicFile(models.Model): file = models.FileField(upload_to=files) def exist_in_playlist(self, playlist_id): exist =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.