Autocomplete

Even though autocomplete is generally most useful in a web app, e.g. for customer lookup, here it is implemented in the data layer and has no “web” parts to it per se. (Which means you could add autocomplete to your console app?)

An “autocompleter” in Rattail is really just an object with one important method, autocomplete().

Rattail comes with several autocompleters built-in. You can get a new autocompleter easily enough from the app handler, and using it is just as easy:

products_ac = app.get_autocompleter('products')
results = products_ac.autocomplete('root beer')

The results will be a list of dicts, each will have at least value (uuid) and label (name/description) items.

See also Autocompleter and get_autocompleter().