def check_user_support(user_obj):
 if (not is_authenticated(user_obj)):
  if (settings.ANONYMOUS_USER_NAME is None):
   return (False, user_obj)
  User = get_user_model()
  lookup = {User.USERNAME_FIELD: settings.ANONYMOUS_USER_NAME}
  user_obj = User.objects.get(**lookup)
 return (True, user_obj)

def check_user_support ( user_obj ) : if ( not is_authenticated ( user_obj ) ) : if ( settings . ANONYMOUS_USER_NAME is None ) : return ( False , user_obj ) User = get_user_model ( ) lookup = { User . USERNAME_FIELD : settings . ANONYMOUS_USER_NAME } user_obj = User . objects . get ( ** lookup ) return ( True , user_obj )
returns a tuple of checkresult and user_obj which should be used for permission checks checks if the given user is supported .