Fields

Reference

Contains all the Django fields for select2-chained.

class django_select2_chained.fields.ChainedAutoModelSelect2FieldMixin(*args, **kwargs)[source]

A mixin for subclasses of AutoModelSelect2Field that adds chaining functionality.

The attached field gets filtered by another field in the form, specified by the chain_field attribute. The selected option in the chain_field limits the queryset in the current field.

prepare_qs_params(request, search_term, search_fields)[source]

Prepare queryset parameters for filtering.

class django_select2_chained.fields.ChainedAutoModelSelect2Field(*args, **kwargs)[source]

An AutoModelSelect2Field with chaining functionality.

class django_select2_chained.fields.RequestSpecificAutoModelSelect2Field(*args, **kwargs)[source]

An AutoHeavy field whose queryset is determined from the current request parameter.

This is done by using get_queryset method instead of the class-level queryset property. Allows using the same AutoHeavy field instance between multiple requests and having request-specific data.

get_queryset(request)[source]

Method that determines the queryset from the current request.

Must be implemented.

get_results(request, term, page, context)[source]

See views.Select2View.get_results().

This implementation takes care of detecting if more results are available.

class django_select2_chained.fields.ChainedRequestSpecificAutoModelSelect2Field(*args, **kwargs)[source]

A RequestSpecificAutoModelSelect2Field with chaining functionality.