Changes between Version 18 and Version 19 of S3/S3ReusableField


Ignore:
Timestamp:
01/20/14 08:33:43 (11 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3/S3ReusableField

    v18 v19  
    99A '''{{{S3ReusableField}}}''' is to be defined like a normal [http://web2py.com/book/default/chapter/06?search=Field#DAL,-Table,-Field Field] (though outside any '''{{{Table}}}''' definitions):
    1010
    11 {{{
     11{{{#!python
    1212person_id = S3ReusableField("person_id", db.pr_person,
    1313                            sortby = ["first_name", "middle_name", "last_name"],
     
    3131To use this in a '''{{{Table}}}''' definition, just call the '''{{{S3ReusableField}}}''' object to generate a '''{{{Field}}}''' instance:
    3232
    33 {{{
     33{{{#!python
    3434resourcename = "mytable"
    3535tablename = "%s_%s" % (module, resourcename)
     
    4545You can override the name and any attributes when generating the '''{{{Field}}}''' instance, by just re-specifying them:
    4646
    47 {{{
     47{{{#!python
    4848resourcename = "mytable"
    4949tablename = "%s_%s" % (module, resourcename)
     
    5959To deactivate a '''{{{IS_NULL_OR}}}''' ('''{{{IS_EMPTY_OR}}}''') validator in the '''{{{S3ReusableField}}}''' when generating the '''{{{Field}}}''' instance, you can use the special attribute '''{{{empty}}}''':
    6060
    61 {{{
     61{{{#!python
    6262resourcename = "mytable"
    6363tablename = "%s_%s" % (module, resourcename)