Add doc about autocompleters

This commit is contained in:
Lance Edgar 2021-10-16 22:13:58 -04:00
parent 922a7a5f11
commit aa24c669a5
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,25 @@
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,
:meth:`~rattail:rattail.autocomplete.base.Autocompleter.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 :class:`~rattail:rattail.autocomplete.base.Autocompleter` and
:meth:`~rattail:rattail.app.AppHandler.get_autocompleter()`.

View file

@ -14,6 +14,7 @@ Data Layer
sync
versioning
batch/index
autocomplete
custorders/index
reports/index
problems