title: Session key error while updating the page counts?
body: <p>Here I am updating the page count in the homepage view but this code is not working properly.</p>
  <p>It gives the <code>IntegrityError</code> saying <code>NOT NULL constraint failed: mysite_pagevisit.session</code></p>
  <p>What might be the reason? How can I solve it ?</p>
  <pre><code>class HomePageView(View):
      def get(self, request):
          if not PageVisit.objects.filter(session=request.session.session_key):
              PageVisit.objects.create(ip=request.META['REMOTE_ADDR'], session=request.session.session_key)
  </code></pre>
  <p>settings</p>
  <pre><code>SESSION_COOKIE_AGE = 5  #for test
  </code></pre>
  <p>models</p>
  <pre><code>class PageVisit(models.Model):
      ip = models.GenericIPAddressField()
      session = models.CharField(max_length=255)
      created = models.DateTimeField(auto_now_add=True)
  
      @property
      def total_visits(self):
          return PageVisit.objects.count()
  </code></pre>