title: django request.user.is_authenticated() isn't returning true after page refresh (sometimes)
body: <p>I have a registration form. After it is submitted, the page refreshes and I get some information back based on <code>request.user</code>. Sometimes <code>request.user.is_authenticated()</code> is returning <code>True</code> and everything works fine.... and sometimes <code>False</code> seemingly randomly.</p>
  
  <p>I appreciate any insight into why this might be happening.</p>
  
  <h2>Registration form code</h2>
  
  <pre><code>$('#reg_form').submit(function(e) {
      e.preventDefault();
      e.stopPropagation();
  
      var serializedData = $(this).serializeArray();
      var names = serializedData.map(function(r) {
          return r.name;
      });
      var index_user = names.indexOf("regusername");
      var index_pass = names.indexOf("regpassword1");
      var index_email = names.indexOf("regemail");
  
      var data2 = {};
      data2["username"] = serializedData[index_user].value;
      data2["password1"] = serializedData[index_pass].value;
      data2["password"] = serializedData[index_pass].value;
      data2["password2"] = serializedData[index_pass].value;
      data2["email"] = serializedData[index_email].value;
  
      console.log(data2);
  
      var serializedFormData = $(this).serialize();
  
      $.ajax({
          url: window.url_root + '/accountsjson/register/',
          type: 'POST',
          dataType: 'json',
          data: data2,
          success: function(data) {
              console.log(data); //remove
              if (data.hasOwnProperty('success')) {
                  console.log("successful registration detected!!");
                  utils.loginAfterRegister(data2);
                  $('.register').slideUp();
                  $('.frame').hide();
              } else {
                  utils.showRegister();
  
              }
          },
          error: function() {
              console.log("ERROR posting registration request. Abort!");
          },
      });
  </code></pre>
  
  <h2>Function called from <code>loginAfterRegister</code> which has the refresh</h2>
  
  <pre><code>function sendRating(rating, reload_on_return) {
          $.ajax({
              type: "POST",
              dataType: 'json',
              url: window.url_root + "/savecommentrating/1/" + rating.cid + "/",
              data: {
                  "rating": rating.r2 / 100.0
              },
              success: function(data) {
                  if (data.hasOwnProperty('success')) {
                      console.log("data was sent!");
  
  
                      if (reload_on_return) {
                          location.reload();
                      }
  
                  }
              },
              error: function() {
                  console.log("rating didn't get sent!!");
              }
          })
  
      }
  </code></pre>
  
  <h2>mobile function within <code>views.py</code></h2>
  
  <pre><code>def mobile(request):
      create_visitor(request)
      os = get_os(1)
      disc_stmt = get_disc_stmt(os, 1)
  
      return render_to_response('mobile.html', context_instance = RequestContext(request, {'url_root' : settings.URL_ROOT,
                                               'loggedIn' : str(request.user.is_authenticated()).lower(),
                                               'client_data': mobile_client_data(request),
                                               'client_settings': get_client_settings(True),
                                               }))
  </code></pre>
  
  <h2><code>create_visitor()</code></h2>
  
  <pre><code>def create_visitor(request):
      # See if we need to create a visitor here                                                                                                                                     
      if not request.user.is_authenticated() and not request.session.get('visitor_id', False):
          visitor = Visitor()
          visitor.save()
          request.session['visitor_id'] = visitor.id
  </code></pre>