dj_angles.mappers.mapper

Module Contents

dj_angles.mappers.mapper.TAG_NAME_TO_DJANGO_TEMPLATE_TAG_MAP: dict[str | None, collections.abc.Callable | str]

Default mappings for tag names to Django template tags.

dj_angles.mappers.mapper.tag_map: TagMap | None = None
class dj_angles.mappers.mapper.TagMap

Bases: collections.UserDict

A MutableMapping is a generic container for associating key/value pairs.

This class provides concrete generic implementations of all methods except for __getitem__, __setitem__, __delitem__, __iter__, and __len__.

data: dict[str | None, collections.abc.Callable | str]
add_custom_mappers() None

Get custom mappers from settings and add it to the tag map.

add_default_mapper() None

Add default mapper if in settings, or fallback to the default mapper.

import_strings()

Try importing any values that are strings.

add_module_mapper(module: str, tag_name: str, mapper: str | collections.abc.Callable) None

Add module mappers depending on whether it is installed or not.

dj_angles.mappers.mapper.get_tag_map() TagMap

Get the complete tag map based on the default, dynamic, and settings mappers.

dj_angles.mappers.mapper.clear_tag_map() None

Clear the generated tag map so that it will be re-generated. Useful for tests.