title: How can I modify Django's login_required decorator on a custom Pinax installation?
body: <p>I would like to have Django's <code>@login_required</code> decorator test whether a particular field on a User has been set to something other than None. (The added field has null = true and a default of None.)</p>
  
  <p>Newly created User objects do indeed have a value of None for the field, but an obvious change to <code>@login_required</code> has made no discernible difference in the behavior (I restarted Gunicorn to ensure a fresh read). <code>@login_required</code> views are rendered if the user is authenticated, even if the added field is None.</p>
  
  <p>The present, slightly changed <code>@login_required</code> is:</p>
  
  <pre><code>def login_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME):
      """
      Decorator for views that checks that the user is logged in, redirecting
      to the log-in page if necessary.
      """
      actual_decorator = user_passes_test(
          lambda u: u.foo != None,
          redirect_field_name=redirect_field_name
      )
      if function:
          return actual_decorator(function)
      return actual_decorator</code></pre>
  
  <p>The original lambda was on <code>u.is_authenticated()</code>.</p>