title: Django Official Tutorial Part 1 index out of bound error
body: <p>I started learning Django recently and am having a strange problem with the tutorial. Everything was going fine until I started playing with the interactive shell and then I got an error whenever I tried to call all the objects in one of the tables.</p>
  
  <p>I am using Django 1.1, Python 2.5 on MacOs X.</p>
  
  <p>For those unfamiliar with the tutorial you are making a website to manage Polls. You have the following code in the model:</p>
  
  <pre><code>from django.db import models
  import datetime
  
  class Poll(models.Model):
      question = models.CharField(max_length=200)
      pub_date = models.DateTimeField('date published')
      def __unicode__(self):
          return self.question
      def was_published_today(self):
          return self.pub_date.date() == datetime.date.today()
      was_published_today.short_description = 'Published today?'
  
  class Choice(models.Model):
      poll = models.ForeignKey(Poll)
      choice = models.CharField(max_length=200)
      votes = models.IntegerField()
      def __unicode__(self):
          return self.choice
  </code></pre>
  
  <p>After creating the model you add a poll item and then add some choices to it.
  Everything was fine until I tried to see all the objects in the choices table or tried to see all the choices in a particular poll. Then I got an error. Heres an example series of commands in the interactive shell. Please note that the count of the choices is correct (I have experimented a bit after running into the error so the count is a bit high.)</p>
  
  <pre><code>&gt;&gt;&gt; from mysite.polls.models import Poll, Choice
  &gt;&gt;&gt; Poll.objects.all()
  [&lt;Poll: What's up&gt;, &lt;Poll: Yups&gt;]
  &gt;&gt;&gt; Choice.objects.count()
  10
  &gt;&gt;&gt; Choice.objects.all()
  Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
    File "/Library/Python/2.5/site-packages/django/db/models/query.py", line 68, in __repr__
      data = list(self[:REPR_OUTPUT_SIZE + 1])
    File "/Library/Python/2.5/site-packages/django/db/models/query.py", line 83, in __len__
      self._result_cache.extend(list(self._iter))
    File "/Library/Python/2.5/site-packages/django/db/models/query.py", line 238, in iterator
      for row in self.query.results_iter():
    File "/Library/Python/2.5/site-packages/django/db/models/sql/query.py", line 287, in results_iter
      for rows in self.execute_sql(MULTI):
    File "/Library/Python/2.5/site-packages/django/db/models/sql/query.py", line 2369, in execute_sql
      cursor.execute(sql, params)
    File "/Library/Python/2.5/site-packages/django/db/backends/util.py", line 19, in execute
      return self.cursor.execute(sql, params)
    File "/Library/Python/2.5/site-packages/django/db/backends/sqlite3/base.py", line 193, in execute
      return Database.Cursor.execute(self, query, params)
    File "/Library/Python/2.5/site-packages/django/db/backends/util.py", line 82, in typecast_timestamp
      seconds = times[2]
  IndexError: list index out of range
  </code></pre>
  
  <p>The Django tutorial(part 1) can be found <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01" rel="nofollow noreferrer">here</a></p>
  
  <p>Thanks!</p>