• 1575 views
  • 0 comments
  • loading...

Search records

crud.search(db.tablename) returns a tuple (form, records) where form is a search form and records is a list of records based on the submitted search form.


crud.search(table, query, queries, query_labels, fields, field_labels, zero, showall, chkall)


Attributes / Arguments

 DAL table or a tablename the method should act on

Query is the query to be used to select records.

queries a list like ['equals', 'not equal', 'contains'] containing the allowed methods in the search form.

query_labels a dictionary like query_labels=dict(equals='Equals') giving names to search methods.

fields is a list of fields to be selected.

field_labels a dictionary mapping field names into labels.

zero defaults to "choose one" is used as default option for the drop-down in the search widget.

Showall set it to True if you want rows returned as per the query in the first call (added after 1.98.2).

chkall set it to True to turn on all the checkboxes in the search form (added after 1.98.2).


Examples

loading...


Powered by
Web2py

Hosted on
www.pythonanywhere.com
(affiliated link)