Package web2py :: Package gluon :: Module sql :: Class Field
[hide private]
[frames] | no frames]

Class Field

source code

object --+    
         |    
Expression --+
             |
            Field

an instance of this class represents a database field

example:

   a = Field(name, 'string', length=32, default=None, required=False,
       requires=IS_NOT_EMPTY(), ondelete='CASCADE',
       notnull=False, unique=False,
       uploadfield=True, widget=None, label=None, comment=None,
       uploadfield=True, # True means store on disk,
                         # 'a_field_name' means store in this field in db
                         # False means file content will be discarded.
       writable=True, readable=True, update=None, authorize=None,
       autodelete=False, represent=None, uploadfolder=None)

to be used as argument of SQLDB.define_table

allowed field types: string, boolean, integer, double, text, blob, date, time, datetime, upload, password

strings must have a length or 512 by default. fields should have a default or they will be required in SQLFORMs the requires argument is used to validate the field input in SQLFORMs

Instance Methods [hide private]
 
__init__(self, fieldname, type='string', length=None, default=None, required=False, requires='<default>', ondelete='CASCADE', notnull=False, unique=False, uploadfield=True, widget=None, label=None, comment=None, writable=True, readable=True, update=None, authorize=None, autodelete=False, represent=None, uploadfolder=None, compute=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
store(self, file, filename=None, path=None) source code
 
retrieve(self, name, path=None) source code
 
formatter(self, value) source code
 
validate(self, value) source code
 
lower(self) source code
 
upper(self) source code
 
year(self) source code
 
month(self) source code
 
day(self) source code
 
hour(self) source code
 
minutes(self) source code
 
seconds(self) source code
 
count(self) source code
 
sum(self) source code
 
max(self) source code
 
min(self) source code
 
__getslice__(self, start, stop) source code
 
__getitem__(self, i) source code
 
__str__(self)
str(x)
source code

Inherited from Expression: __add__, __div__, __eq__, __ge__, __gt__, __invert__, __le__, __lt__, __mul__, __ne__, __nonzero__, __or__, __sub__, belongs, len, like

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, fieldname, type='string', length=None, default=None, required=False, requires='<default>', ondelete='CASCADE', notnull=False, unique=False, uploadfield=True, widget=None, label=None, comment=None, writable=True, readable=True, update=None, authorize=None, autodelete=False, represent=None, uploadfolder=None, compute=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)