# How to Use Template Tags and Filters django-stratagem ships template tags and filters for rendering registry data. ## Loading Template Tags ```html {% load stratagem %} ``` ## Tags ### get_implementations Get all implementations for a registry, optionally filtered by context. ```html {% get_implementations my_registry as implementations %} {% get_implementations my_registry context as implementations %} {% for slug, impl in implementations.items %}

{{ slug }}: {{ impl }}

{% endfor %} ``` ### get_choices Get a choices list for a registry. ```html {% get_choices my_registry as choices %} {% get_choices my_registry context as choices %} {% for slug, label in choices %} {% endfor %} ``` ### get_registries Get all registered registries. ```html {% get_registries as registries %} {% for registry in registries %}

{{ registry.__name__ }}

{% endfor %} ``` ## Filters ### display_name Get the human-readable display name for an implementation. ```html {{ implementation|display_name }} {{ implementation|display_name:my_registry }} ``` ### registry_icon Get the icon for an implementation. ```html {{ implementation|registry_icon }} ``` ### registry_description Get the description for an implementation. ```html {{ implementation|registry_description }} ``` ### is_available Check if an implementation is available in a given context. ```html {% if implementation|is_available:context %} Available {% endif %} ``` ## Full Example A fuller example listing notification channels with their metadata: ```html {% load stratagem %} {% get_implementations notification_registry request_context as channels %}
{% for slug, impl in channels.items %}
{% if impl|registry_icon %} {% endif %}

{{ impl|display_name }}

{{ impl|registry_description }}

{% if impl|is_available:request_context %} Available {% else %} Unavailable {% endif %}
{% endfor %}
```