title: Why is my Django view being hit twice with every page view?
body: <p>I can't seem to find the problem for the life of me. Very simply, I have a database object that I'm pulling from the database, incrementing it's "views" by one, and saving. My view display's the incremented value, but then my logs show that the value is incremented AGAIN.</p>
  
  <pre><code>g=Game.objects.filter(slug=slug).distinct()[0]
  g.views += 1
  g.save()
  </code></pre>
  
  <p>Here's my logs:</p>
  
  <pre><code>[Fri Oct 29 15:15:49 2010] [error] DEBUG:root:Updating plays
  [Fri Oct 29 15:15:49 2010] [error] DEBUG:root:plays: 40
  [Fri Oct 29 15:15:50 2010] [error] DEBUG:root:Updating plays
  [Fri Oct 29 15:15:50 2010] [error] DEBUG:root:plays: 41
  </code></pre>
  
  <p>My view shows that it has 40 hits. This causes that my view increments by 2 every time I refresh:</p>
  
  <pre><code>[Fri Oct 29 15:20:19 2010] [error] DEBUG:root:Updating plays 
  [Fri Oct 29 15:20:19 2010] [error] DEBUG:root:plays: 42
  [Fri Oct 29 15:20:19 2010] [error] DEBUG:root:Updating plays
  [Fri Oct 29 15:20:19 2010] [error] DEBUG:root:plays: 43
  </code></pre>
  
  <p>Any hints as to what this could be? </p>
  
  <p>EDIT:</p>
  
  <p>Here's my view. I simplified it to the core elements (and it still behaves oddly).</p>
  
  <pre><code>def game(request, slug=None):
  
      g=Game.objects.filter(slug=slug)[0]
  
      if g:
          comments=GameComment.objects.filter(item=g, parent__isnull=True)
          g.plays+=1
          g.save()
      else:
          comments=None
  
      return render_to_response('goto/goto_game.html', {'g': g, 'comments':comments, 'cCount':len(comments) if comments else 0, 'newCCount':0}, request=request)
  </code></pre>