apis_core.apis_entities.views#

Module Contents#

Classes#

EntitiesAutocomplete

This endpoint allows us to use autocomplete over multiple model classes. It takes a parameter entities which is a list of ContentType natural keys and searches for the query in all instances of those entities (using generate_search_filter, which means it uses a different search approach for every model). The return values of the endpoint are then prefixed with the id of the contenttype of the results, separated by an underscore.

API#

class apis_core.apis_entities.views.EntitiesAutocomplete(**kwargs)#

Bases: dal.autocomplete.Select2QuerySetView

This endpoint allows us to use autocomplete over multiple model classes. It takes a parameter entities which is a list of ContentType natural keys and searches for the query in all instances of those entities (using generate_search_filter, which means it uses a different search approach for every model). The return values of the endpoint are then prefixed with the id of the contenttype of the results, separated by an underscore.

Example: Using this endpoint with the parameters:

?entities=apis_ontology.person&entities=apis_ontology.place&q=ammer

gives you all the persons and places that have ammer in their names and labels.

Initialization

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get_result_value(result) → str#
get_queryset()#