title: How to make my welcome text appear?
body: <p>After login, I want the text "Welcome, Niklas" to display but after logging in I have to reload the <a href="http://www.koolbusiness.com/example" rel="nofollow">page</a> and I didn't understand how to make the page display the text from the server variable <code>current_user</code>. If I login and press reload then the correct welcome message appears. Can you help me achieve what I want? Why is there no simple working example for FB python + javascript? Can I implement facebook connect without javascript? If so, do I have to use and set the cookie myself? Thank you</p>
  
  <pre><code>{% load i18n %}
  &lt;!DOCTYPE html&gt; 
  &lt;html xmlns:fb="https://www.facebook.com/2008/fbml"&gt;
    &lt;head&gt; 
      &lt;title&gt; 
        Test Facebook SDK
      &lt;/title&gt; 
    &lt;/head&gt; 
  &lt;body&gt; 
  &lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script&gt;
    window.fbAsyncInit = function() {
      FB.init({
        appId      : '164355773607006', // App ID
        channelURL : '//WWW.KOOLBUSINESS.COM/static/channel.html', // Channel File
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        oauth      : true, // enable OAuth 2.0
        xfbml      : true  // parse XFBML
      });
    };
    // Load the SDK Asynchronously
    (function(d){
       var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       d.getElementsByTagName('head')[0].appendChild(js);
     }(document));
  &lt;/script&gt;
  &lt;fb:login-button autologoutlink="true"&gt;&lt;/fb:login-button&gt;
  {% if current_user %}
  &lt;div id="user-ident"&gt;
  &lt;span&gt;{% trans "Welcome," %} &lt;b&gt;{{ current_user.name|escape }}&lt;/b&gt;&lt;/span&gt;
  &lt;/div&gt;
  {% endif %}
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <p>Here's how I get the variable <code>current_user</code></p>
  
  <pre><code>@property
  def current_user(self):
      if not hasattr(self, "_current_user"):
          self._current_user = None
          cookie = facebook.get_user_from_cookie(
              self.request.cookies, facebookconf.FACEBOOK_APP_ID, facebookconf.FACEBOOK_APP_SECRET)
          logging.debug("logging cookie"+str(cookie))
          if cookie:
              # Store a local instance of the user data so we don't need
              # a round-trip to Facebook on every request
              user = FBUser.get_by_key_name(cookie["uid"])
              logging.debug("user "+str(user))
              logging.debug("username "+str(user.name))
  
              if not user:
                  graph = facebook.GraphAPI(cookie["access_token"])
                  profile = graph.get_object("me")
                  user = FBUser(key_name=str(profile["id"]),
                              id=str(profile["id"]),
                              name=profile["name"],
                              profile_url=profile["link"],
                              access_token=cookie["access_token"])
                  user.put()
              elif user.access_token != cookie["access_token"]:
                  user.access_token = cookie["access_token"]
                  user.put()
              self._current_user = user
      return self._current_user
  </code></pre>