Skip to main content

CaseInsensitiveMapping

Mapping allowing case-insensitive key lookups. Original case of keys is preserved for iteration and string representation.

Attributes

AttributeTypeDescription
_storedictInternal dictionary mapping lowercase keys to tuples of the original key and its associated value to facilitate case-insensitive lookups while preserving original casing.

Constructor

Signature

def CaseInsensitiveMapping(
data: [Union](../../contrib/gis/db/models/functions/union.md?sid=django_contrib_gis_db_models_functions_union)[dict, Mapping, Iterable[[Tuple](../../db/models/fields/tuple/lookups/tuple.md?sid=django_db_models_fields_tuple_lookups_tuple)[str, Any]]]
)

Parameters

NameTypeDescription
data[Union](../../contrib/gis/db/models/functions/union.md?sid=django_contrib_gis_db_models_functions_union)[dict, Mapping, Iterable[[Tuple](../../db/models/fields/tuple/lookups/tuple.md?sid=django_db_models_fields_tuple_lookups_tuple)[str, Any]]]The initial data to populate the mapping, which can be a dictionary, another mapping, or an iterable of key-value pairs.

Methods


copy()

@classmethod
def copy() - > [CaseInsensitiveMapping](caseinsensitivemapping.md?sid=django_utils_datastructures_caseinsensitivemapping)

Returns the mapping instance itself, as the object is intended to be treated as immutable.

Returns

TypeDescription
[CaseInsensitiveMapping](caseinsensitivemapping.md?sid=django_utils_datastructures_caseinsensitivemapping)The current instance of the mapping.