Package s3 :: Module s3mobile :: Class S3MobileSchema
[frames] | no frames]

Class S3MobileSchema

source code

object --+
         |
        S3MobileSchema

Table schema for a mobile resource

Instance Methods
 
__init__(self, resource)
Constructor
source code
 
serialize(self)
Serialize the table schema
source code
 
references(self)
Tables (and records) referenced in this schema (lazy property)
source code
 
form(self)
The mobile form (field order) for the resource (lazy property)
source code
 
subheadings(self)
The subheadings for the mobile form (lazy property)
source code
 
settings(self)
Directly-serializable settings from s3db.configure (lazy property)
source code
 
describe(self, field)
Construct a field description for the schema
source code
 
get_options(self, field, lookup=None)
Get the options for a field with IS_IN_SET
source code
 
get_default(self, field, lookup=None, superkey=False)
Get the default value for a field
source code
 
fields(self)
Determine which fields need to be included in the schema
source code
 
lookup_only(self)
Whether the resource shall be exposed as mere lookup list without mobile form (lazy property)
source code
 
llrepr(self)
The lookup list representation method for the resource
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods
 
is_required(field)
Determine whether a value is required for a field
source code
 
has_mobile_form(tablename)
Check whether a table exposes a mobile form
source code
 
mobile_form(resource)
Get the mobile form for a resource
source code
 
get_uuid(tablename, record_id)
Look up the UUID of a record
source code
Class Variables
  SUPPORTED_FIELD_TYPES = "string", "text", "integer", "double",...
Properties

Inherited from object: __class__

Method Details

__init__(self, resource)
(Constructor)

source code 

Constructor

@param resource - the S3Resource

Overrides: object.__init__

serialize(self)

source code 

Serialize the table schema

Returns:
a JSON-serializable dict containing the table schema

references(self)

source code 

Tables (and records) referenced in this schema (lazy property)

Returns:
a dict {tablename: [recordID, ...]} of all referenced tables and records
Decorators:
  • @property

form(self)

source code 

The mobile form (field order) for the resource (lazy property)

Decorators:
  • @property

subheadings(self)

source code 

The subheadings for the mobile form (lazy property)

Decorators:
  • @property

settings(self)

source code 

Directly-serializable settings from s3db.configure (lazy property)

Decorators:
  • @property

describe(self, field)

source code 

Construct a field description for the schema

Parameters:
  • field - a Field instance
Returns:
the field description as JSON-serializable dict

is_required(field)
Static Method

source code 

Determine whether a value is required for a field

Parameters:
  • field - the Field
Returns:
True|False

get_options(self, field, lookup=None)

source code 

Get the options for a field with IS_IN_SET

Parameters:
  • field - the Field
  • lookup - the name of the lookup table
Returns:
a list of tuples (key, label) with the field options

get_default(self, field, lookup=None, superkey=False)

source code 

Get the default value for a field

Parameters:
  • field - the Field
  • lookup - the name of the lookup table
  • superkey - lookup table is a super-entity
Returns:
the default value for the field

fields(self)

source code 

Determine which fields need to be included in the schema

Returns:
a list of Field instances

has_mobile_form(tablename)
Static Method

source code 

Check whether a table exposes a mobile form

Parameters:
  • tablename - the table name
Returns:
True|False

mobile_form(resource)
Static Method

source code 

Get the mobile form for a resource

Parameters:
  • resource - the S3Resource
Returns:
an S3SQLForm instance

lookup_only(self)

source code 

Whether the resource shall be exposed as mere lookup list without mobile form (lazy property)

Decorators:
  • @property

llrepr(self)

source code 

The lookup list representation method for the resource

Decorators:
  • @property

get_uuid(tablename, record_id)
Static Method

source code 

Look up the UUID of a record

Parameters:
  • tablename - the table name
  • record_id - the record ID
Returns:
the UUID of the specified record, or None if the record does not exist or has no UUID

Class Variable Details

SUPPORTED_FIELD_TYPES

Value:
"string", "text", "integer", "double", "date", "datetime", "boolean", \
"reference", "upload",