Changes between Version 17 and Version 18 of S3/S3ResourceFilter
- Timestamp:
- 05/11/12 10:49:23 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3ResourceFilter
v17 v18 44 44 == Field Selectors == 45 45 46 S3ResourceQuery instances are based on S3 QueryField field selectors. A field selectoris a string with the so-called "list_fields syntax":46 S3ResourceQuery instances are based on S3FieldSelector, which is a string with the so-called "list_fields syntax": 47 47 48 48 {{{ … … 54 54 - '''field''' is the name of the field or a virtual field in the table addressed by ''alias'' (plus ''foreign key'' where present). 55 55 56 To access fields in a table which is linked via a link table, replace the fkey by the link table name and add left and right key if n eeded:56 To access fields in a table which is linked via a link table, replace the fkey by the link table name and add left and right key if not already specified by add_component: 57 57 {{{ 58 58 alias.{{lkey:}linktable{:rkey}$}field … … 65 65 66 66 lkey and rkey ''can'' be omitted if they are not ambiguous, i.e. if there's only one option each. 67 67 68 == URL queries == 68 69 … … 116 117 == Extending filters at the back-end == 117 118 118 S3 QueryFieldinstances can also be generated at the back-end, simply by:119 S3FieldSelector instances can also be generated at the back-end, simply by: 119 120 120 121 {{{ 121 selector = S3 QueryField(<field selector>)122 selector = S3FieldSelector(<field selector>) 122 123 }}} 123 124 … … 125 126 126 127 {{{ 127 afilter = S3 QueryField("person.first_name") == "Dominic"128 bfilter = ~(S3 QueryField("person.first_name").like("Dominic")) # negation by ~ operator128 afilter = S3FieldSelector("person.first_name") == "Dominic" 129 bfilter = ~(S3FieldSelector("person.first_name").like("Dominic")) # negation by ~ operator 129 130 }}} 130 131 … … 147 148 148 149 {{{ 149 cfilter = (S3 QueryField("person.first_name") == "Dominic") & (S3QueryField("contact.value") == "dominic@nursix.org")150 cfilter = (S3FieldSelector("person.first_name") == "Dominic") & (S3FieldSelector("contact.value") == "dominic@nursix.org") 150 151 }}} 151 152 … … 155 156 156 157 {{{ 157 myfilter = S3 QueryField("person.first_name") == "Dominic"158 myfilter = S3FieldSelector("person.first_name") == "Dominic" 158 159 resource.add_filter(myfilter) 159 160 }}}