69d97b1c08
gitea-wip/combo/pipeline/head Build started...
Details
gitea/combo/pipeline/head Build started...
Details
|
||
---|---|---|
.. | ||
migrations | ||
templates/combo | ||
README | ||
__init__.py | ||
engines.py | ||
forms.py | ||
manager_views.py | ||
models.py | ||
urls.py | ||
utils.py |
README
Configure search services in settings.COMBO_SEARCH_SERVICES: COMBO_SEARCH_SERVICES = { 'user': { 'label': 'Search a user', 'url': 'https://.../api/user/?q=%(q)s', # 'cache_duration': 60, # in seconds, default is 0 # 'signature': True, # boolean, default is False }, } 'url' must return a JSON: { "err": 0, "data": [ { 'url': 'https://example.net/page3/', 'text': 'example, page3', 'description': 'this can be <b>html</b> text' }, { ... }, ... ] ... } which is sent to template 'combo/search-cell-results.html' If the cell slug is "foo" and a variable named "foo" exists in the query_string, it is added to the global page context, so it can be used, for example, by a JsonCell. It is also possible to extend the search service definition with custom templates for hit URLs and labels: COMBO_SEARCH_SERVICES = { 'user': { 'label': 'Search a user', 'url': 'https://.../api/user/?q=%(q)s', 'hit_url_template': '/fiche-usager/{{user_name_identifier_0}}/', 'hit_label_template': '{{first_name}} {{last_name}}', }, }