Changes between Version 24 and Version 25 of S3/S3ResourceFilter


Ignore:
Timestamp:
06/13/14 12:17:48 (7 years ago)
Author:
MattS
Comment:

syntax highlighting

Legend:

Unmodified
Added
Removed
Modified
  • S3/S3ResourceFilter

    v24 v25  
    121121S3FieldSelector instances can also be generated at the back-end, simply by:
    122122
    123 {{{
     123{{{#!python
    124124selector = S3FieldSelector(<field selector>)
    125125}}}
     
    127127Such selectors can then be used to create filter queries, using a syntax very similar to web2py queries:
    128128
    129 {{{
     129{{{#!python
    130130afilter = S3FieldSelector("person.first_name") == "Dominic"
    131131bfilter = ~(S3FieldSelector("person.first_name").like("Dominic"))  # negation by ~ operator
     
    149149These filter queries can also be joined together by {{{&}}} and {{{|}}} operators:
    150150
    151 {{{
     151{{{#!python
    152152cfilter = (S3FieldSelector("person.first_name") == "Dominic") & (S3FieldSelector("contact.value") == "dominic@nursix.org")
    153153}}}
     
    157157To add a filter to a resource is as simple as:
    158158
    159 {{{
     159{{{#!python
    160160myfilter = S3FieldSelector("person.first_name") == "Dominic"
    161161resource.add_filter(myfilter)
     
    166166You can though also specify a standard web2py Query for add_filter, in which case you would have to specify the respective join manually. If you specify a component alias as "c" parameter, the join for this component would be added automatically.
    167167
    168 {{{
     168{{{#!python
    169169myfilter = db.pr_contact.value == "dominic@nursix.org"
    170170resource.add_filter(myfilter, c="contact")