Changes between Version 6 and Version 7 of S3/S3ResourceFilter

01/31/12 13:22:41 (12 years ago)
Dominic König



  • S3/S3ResourceFilter

    v6 v7  
    4040This process supports pagination (slicing), although that would necessarily not only retrieve the requested page from the database, but all records which match the DAL query. Therefore, the virtual filters should always only be the "last mile", while the DAL query reduces the number of candidates to the necessary minimum.
     42== Field Selectors ==
     44S3ResourceQuery instances are based on S3QueryField field selectors. A field selector is a string with the so-called "list_fields syntax":
     47alias.{foreign key$}field
     50  - '''alias''' is the alias of the component without prefix, e.g. "contact" for the pr_contact component (note that components may use aliases different from their table name). For the primary table of a resource (master table), "alias" is just the tablename without prefix.
     51  - '''foreign key''' is the name of a foreign key field in the table specified by ''alias'', both together addressing the table referenced by this foreign key. It is possible to chain foreign key selectors to address tables which are more than one reference level away. Note that only real foreign key fields can be used (i.e. neither integer fields nor virtual fields).
     52  - '''field''' is the name of the field or a virtual field in the table addressed by ''alias'' (plus ''foreign key'' where present).
     54With this syntax, it is possible to address fields in the primary table, in component tables and in directly referenced tables.
     56It is not yet possible to address fields in tables linked by link tables - this is though subject to change in the near future.
    4258== URL queries ==
     60Filters can be specified in URLs simply by adding URL query variables in the form:
     63<field selector>__<operator>=<value>
     66(Note: these are two underscores between field selector and operator)
     68The following operators are supported:
     71||lt||less than||||
     72||le||less or equal||||
     73||eq||equal||can be omitted (=default)||
     74||ne||not equal||||
     75||ge||greater or equal||||
     76||gt||greater than||||
     77||contains||containment||given value belongs to field value (which is a list)||
     78||belongs||reverse containment||field value belongs to a list of given values||
     79||like||string containment||case-insensitive||
     81No negate an operator, simply append a ! to the operator like in:
     87The '''value''' can be a single value, a comma-separated list of values. NONE specifies a null-value (undefined, Python None). Values in quotes are treated as strings, i.e.
     93specifies the value {{{None}}}, whereas
     99specifies the string "NONE".
     101It is currently not possible to escape quotation marks in order to enclose them in strings - thus strings must not contain quotation marks.
     103For all operators except __belongs, any comma-separated lists of values are treated as alternatives (OR) ''unless'' the field contains a list as well. All operators except __like are case-sensitive.
    44105== Extending filters at the back-end ==