Changes between Version 12 and Version 13 of S3/S3ResourceFilter


Ignore:
Timestamp:
01/31/12 14:25:36 (13 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3/S3ResourceFilter

    v12 v13  
    150150}}}
    151151
    152 If your filter involves a component table, you may need to add the respective joins. This can be done simply by specifying the component alias in the add_filter call:
     152Joins which become necessary for filters will be added automatically as long as you use S3ResourceQuery instances with add_filter.
     153
     154You 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.
    153155
    154156{{{
    155 myfilter = S3QueryField("contact.value") == "dominic@nursix.org"
    156 resource.add_filter(myfilter, c="contact")  # also adds the join for the "contact" component to the resource query
     157myfilter = db.pr_contact.value == "dominic@nursix.org"
     158resource.add_filter(myfilter, c="contact")
    157159}}}
    158160
    159 For URL filters, this happens automatically.
     161Note that S3ResourceQuery instances are resource-agnostic, so they can be re-used across resources (provided the same field selector applies in all of them).
    160162
    161 Note that filters as such (i.e. S3ResourceQuery instances) are resource-agnostic, so they can be re-used across resources (provided the same field selector applies in all of them).
    162 
    163 Filters for fields which are not defined in a resource will be ignored quietly when retrieving records from the resource.
     163S3ResourceQueries for fields which are not defined in a resource will be ignored quietly when retrieving records from the resource.